|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Delete Record
Hi Again, now that I have created the Search page on my database, I would like to be able
to search for a record and then select one or more records from the list that the search gave me and delete them. How can I do this? The database online if here : http://www.giustinianinicola.com/php/display.php Below is the Search script. <?php if ($search) // perform search only if a string was entered. { mysql_connect("localhost","***","***"); // servername = localhost, username for the database, password $db = "database"; //database name $srch="%".$search."%"; $query = "select * from ISSUE WHERE id LIKE '$srch' || name LIKE '$srch' || surname LIKE '$srch' || phone LIKE '$srch' || status LIKE '$srch'"; $result = mysql_db_query("database", $query) or die("MySQL ERROR #".mysql_errno().": ".mysql_error()); if ($result) { echo "<font face='Tahoma' size=2><b>Here are the results:</b></font><br><br>"; echo "<table border=0 cellpadding=3 cellspacing=5> <tr bgcolor=#104E8B> <td width=10><font size=2 color=#FFFF00 face=tahoma><b>ID</b></font></td> <td width=80><font size=2 color=#FFFF00 face=tahoma><b>First Name</b></font></td> <td width=100><font size=2 color=#FFFF00 face=tahoma><b>Last Name</b></font></td> <td width=50><font size=2 color=#FFFF00 face=tahoma><b>Phone</b></font></td> <td width=50><font size=2 color=#FFFF00 face=tahoma><b>Status</b></font></td> </tr>"; //while ($r = mysql_fetch_array($result)) { // Begin while while ($r = mysql_fetch_array($result)) { // Begin while $id = $r["id"]; $name = $r["name"]; $surname = $r["surname"]; $phone = $r["phone"]; $status = $r["status"]; echo "<tr bgcolor=669966> <td align=left><font color='#ffffff'>$id</font></td> <td align=left><font color='#ffffff'>$name</font></td> <td align=left><font color='#ffffff'>$surname</font></td> <td align=left><font color='#ffffff'>$phone</font></td> <td align=left><font color='#ffffff'>$status</font></td> </tr>"; } // end while echo "</table>"; } } else { echo "Search string is empty. <br> Go back and type a string to search"; } ?> If you need more information please let me know. Thanks a lot |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Delete Record |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|