draftermath
Members-
Posts
10 -
Joined
-
Last visited
Never
Everything posted by draftermath
-
i already have a page that i use to submit articles to. i am looking to log the time it is submitted and also i don't know how i would check page views either. any help would be great, here is what i have now <?php include 'config.php'; include 'opendb.php'; $header = $_POST['header']; $url = $_POST['url']; $description = $_POST['description']; mysql_query("INSERT INTO `articles` (header, url, description) VALUES ('$header', '$url', '$description')"); echo "Success! Your Article has been submitted!"; include 'closedb.php'; ?>
-
i am stuck on this, Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in C:\wamp\www\s2007\view_a.php on line 21 <?php include 'config.php'; include 'opendb.php'; $header = $_GET['header']; $url = $_GET['url']; $description = $_GET['description']; $results = mysql_query("SELECT * FROM articles") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $results )) { // Print out the contents of each row into a table echo "<table width=\"90%\" border=\"0\" bgcolor=\"#0000CC\">"; echo "<tr><td bgcolor=\"#006699\"><div align=\"center\">"; echo '<a href="'.$row["url"].'">'; echo $row['header']; echo "</a></div></td></tr>"; echo "<tr><td bgcolor="#CCCCCC"><div align=\"center\">"; echo $row['description']; echo "</div></td></tr>"; } echo "</table>"; include 'closedb.php'; ?> line 21 is echo $row['description']; but everything looks good to me
-
i am trying to hyperlink text to my url variable, but i can't get the syntax of right. the url variable is the hyperlink to the header text. i thought "<a href=\"$row['url']\">"; would work but it does not, i get Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\s2007\view_a.php on line 17 row 17 corresponds to echo "<a href=\"$row['url']\">"; my explantion might not be clear but please ask any questions that you have <?php include 'config.php'; include 'opendb.php'; $header = $_GET['header']; $url = $_GET['url']; $description = $_GET['description']; $results = mysql_query("SELECT * FROM articles") or die(mysql_error()); // keeps getting the next row until there are no more to get while($row = mysql_fetch_array( $results )) { // Print out the contents of each row into a table echo "<table width=\"90%\" border=\"0\" bgcolor=\"#0000CC\">"; echo "<tr><td bgcolor=\"#006699\"><div align=\"center\">"; echo "<a href=\"$row['url']\">"; echo $row['header']"; echo "</a></div></td></tr>"; echo "<tr><td bgcolor="#CCCCCC"><div align=\"center\"> echo $row['description']; echo "</div></td></tr>"; } echo "</table>"; include 'closedb.php'; ?>
-
[SOLVED] Deleting row of table based on auto-increment number
draftermath replied to draftermath's topic in PHP Coding Help
craygo, you r the shizz, thanks -
[SOLVED] Deleting row of table based on auto-increment number
draftermath replied to draftermath's topic in PHP Coding Help
this is what i currently have $id = $_POST['id']; mysql_query("DELETE FROM `laptop` WHERE `laptop`.`id` = '$id' LIMIT 1"); echo "Success! Your item has been deleted in the inventory!"; but it still does not work, i am stumped. if i run this, it will delete the record with the id 9 $id = $_POST['id']; mysql_query("DELETE FROM `laptop` WHERE `laptop`.`id` = '9' LIMIT 1"); echo "Success! Your item has been deleted in the inventory!"; here is my phpMyAdmin sql table for laptop id model serial svreq pic 9 IBM laptop 23T5cs sr66321 10 HP Laptop jj44121 sr44211 my problem still is that i need it to delete whatever row i click on based on row id. if you need more info from my files please tell me and i will post them -
[SOLVED] Deleting row of table based on auto-increment number
draftermath replied to draftermath's topic in PHP Coding Help
Neptunus, it is a .php file. -
[SOLVED] Deleting row of table based on auto-increment number
draftermath replied to draftermath's topic in PHP Coding Help
i tried that and still nothing, so i will post everything i can here is my database viewing page that has a delete link that will run the query on the page laptop_remove.php index.html $data = mysql_query("SELECT * FROM laptop") or die(mysql_error()); $current_row = 0; Print "<center>Laptops</center>"; Print "<table border cellpadding=2 width=700px align=center>"; Print "<th width=20%>Model:</th> <th width=20%>Serial:</th> <th width=20%>Service Request:</th> <th width=20%>Pic:</th><th width=20%><a href=\"laptopadd.html\">ADD</a></th></td> "; while($info = mysql_fetch_array( $data )) { Print "<tr>"; Print "<tr><td>".$info['model'] . " </td>"; Print "<td>".$info['serial'] . " </td>"; Print "<td>".$info['svreq'] . "</td> "; Print "<td>".$info['pic'] . " </td>"; Print "<td><a href=laptop_remove.php>".delete." </a></td>"; Print "</tr>"; } Print "</table>"; here is my laptop_remove.php page $id = $_POST['id']; mysql_query("DELETE FROM `laptop` WHERE `laptop`.`id` = '$id' LIMIT 1"); echo "Success! Your item has been deleted in the inventory!"; here is my database from phpMyAdmin id model serial svreq pic 6 dell gs eerr sr44221 9 IBM laptop 23T5cs sr66321 10 HP Laptop jj44121 sr44211 i just need to know what my issue is, i believe it is not picking up the id i am totally new at this so the any help would be appreciated -
i am really new to php, this is actually my first project. So i am creating a inventory database, and i need to delete rows based on the auto-increment number on a table here is my code $id = $_POST['id']; mysql_query("DELETE FROM `laptop` WHERE `laptop`.`id` = 1 LIMIT 1"); echo "Success! Your item has been added to the inventory!"; now if i execute this it deletes the row with the id of 1. what i want to do is delete the row based on the record they delete so the number would be a variable based on what row they click the delete button on. any help would be sooo appreciative if my description is confusing please tell me where to elaborate