accessing records from a user definied table

Okay - I"ll take any kind ofhelp I can get. I’ve been at this for about 2 days and I think I’m officially dumb. … Here’s the code…

$db = mysql_connect(***,***,****);
if ($submit) {
//display all the records in that table so the user can select which one to delete
$query = "SELECT * FROM '.$network'";
$result = mysql_query($query,$db);
print "<br>" . $query . "<br>";
$num_results = mysql_num_rows($query);
echo '<p>Number of results found: ".$num_results"</p>';
//put stuff in a table for formatting reasons
echo "<table><font size=2>";
echo "<tr><td>#</td> <td>#</td> <td>#</td> <td>#</td><td>#</td> <td>#</td> <td>#</td> <td>#c</td> <td>#</td> <td>#</td> <td>#</td> <td>#</td></font> </tr>n";
while ($myrow = mysql_fetch_array($result)) {
printf("<font size=2><tr> <td>$myrow[0]</td> <td>$myrow[1]t</td> <td>$myrow[2]</td> <td>$myrow[3]</td> <td>$myrow[4]</td> <td>$myrow[5]</td> <td>$myrow[6]</td> <td>$myrow[7]</td> <td>$myrow[8]</td> <td>$myrow[9]</td> <td>$myrow[10]</td> <td>$myrow[11]</td> <td>$myrow[12]</td> <td><a href="%s?name=%s&delete=yes">(DELETE)</a><br></td></tr> </font>n",$PHP_SELF, $myrow["0"], $myrow["1"], $myrow["2"], $myrow["3"], $myrow["4"], $myrow["5"], $myrow["6"], $myrow["7"], $myrow["8"],$myrow["9"], $myrow["10"],$myrow["11"]);
echo "</font></table>"; 

//if the user pushes delete...
if ($delete) {
//if the user presses the submit button, then the information will be sent to the database to delete it
$sql = "DELETE FROM '.$network' WHERE name=$name"; 
// $result = mysql_query($sql);
import_request_variables(coolThing, "formval_");
//import the variable from the form
$result = mysql_query ($sql, $db);
echo "Record deleted successfully!<p>";
Select the NETWORK to DELETE the record from<br>
<form action="<?php echo $PHP_SELF?>" method="post" name="coolThing">
<select name="network" >
<option value="asdf">asdf</option>
<option value="qerw">qwre</option>
<input type="Submit" name="<?php $submit ?>" value="Enter selection for deleting ">

now my problem is that the html comes up just fine (the purpose of this is for the user to select a option (asdf or qwer) to delete from the asdf or qwre table.
after he pushes “Enter for selection…” then below it should display the information in the database for that table with a delete option at the end of the name …
now the delete function doesn’t work either (i dont’ think) …
so any help would be awesome!!!
thanks so much and i can try to explain better if you need me to …
i’m using php 4.3.2 right now and on OSX.
cool thanks

MOD EDIT: Added spaces to WRAP text so as not to scroll off screen to the RIGHT

Before I even think of looking at your code I will need it shown with proper indenting. Debugging is hard enough without fighting through your coding style to see the underlying logic. I know it sounds harsh and I apologize but we need you to help us help you.

Also I don’t know if your register globals is On or Off. If it is Off then you need to access your form variables with either the $_GET or $_POST syntax (based on which method you used in the form).

Sponsor our Newsletter | Privacy Policy | Terms of Service