PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?
include "../conf.php";
$view = mysql_query("SELECT * FROM product WHERE id=' ' ");
echo ("
<pre>
Name : $view[name]
Price : $view[price]
Manufacture : $view[manuf]
Size : $view[size]
</pre>
");
?>
What i wanna do is,
when i click on "Edit" then open page "view_product.php",
but the ID from the page before still carry on,
so the content of page "edit_product.php" is based on id from database...
as far as i know, i have to put something here...
("SELECT * FROM product WHERE id=' ' ")
but now im stuck,
please i really need help,
thanks..
$id = mysql_real_escape_string($_GET['id']);
$view = mysql_query("SELECT * FROM product WHERE id='$id' ORDER BY id DESC");
$fetch = mysql_fetch_array($view);
@papa
at first the code doesnt work,
after few try & error, I end up with these,
it's work, thanks for give me the clue...
what those code use forstripslashes() ?
I try search, & found these...
stripslashes()
An example use of stripslashes() is when the PHP directive magic_quotes_gpc is on (it's on by default), and you aren't inserting this data into a place (such as a database) that requires escaping. For example, if you're simply outputting data straight from an HTML form.
But I dont really understand, since Im new in php,
would u help me to describe it in ur own word,
That suggests you have a quoting problem in the php where you create the table data. You want the contents of $result[id] but you are getting the name of the variable/array instead. I can't see from your code how you are doing this but my guess would be that you have left PHP (?>) and just typed the HTML including the variable name. If so you need to start PHP again and include the variable. Something like:
The stripslashes() function removes backslashes that Magic Quotes might have added to escape certain characters in user-submitted data (through GET, POST, and cookies).
If Magic Quotes is disabled, stripslashes() will still remove backslashes -- ones that should not be removed. Therefore, you should test whether Magic Quotes is enabled (get_magic_quotes_gpc()) before stripping slashes.