Answer the question
In order to leave comments, you need to log in
How to get a row from the database by id?
How to display a line from the database by id from the url, which I have already been able to get using this code.
<?php
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
parse_str (parse_url ( $url, PHP_URL_QUERY ), $arr);
$obj3 = (object)$arr;
$id = $obj3->id;
print_r($id);
?>
<?php
$db = mysql_connect ("хост","логин","пароль");
mysql_select_db ("база",$db);
mysql_set_charset (utf8);
$result = mysql_query ("SELECT * FROM `users` WHERE `id` =",$id);
$myrow = mysql_fetch_array ($result);
?>
echo $myrow ['login'];
Answer the question
In order to leave comments, you need to log in
$result = mysql_query ("SELECT * FROM `users` WHERE `id` =",$id);
put a dot instead of a comma.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question