$data= "echo * from table1 where id=$_post[ID] "
can anyone see why this line duz not compute please ?
$data= "echo * from table1 where id=$_post[ID] "
can anyone see why this line duz not compute please ?
:-/
assuming you have connected to the database correctly...
$result = mysql_query("select * from table1 where id=$_POST[ID]");
while ($data = mysql_fetch_array($result))
{
foreach($data as $k=>$v)
echo ($k . " = " . $v);
}
or.. something to that effect... but since we are all moving to mysqli, this is already horridly outdated.
Check out http://www.php.net/manual/en/mysqli.quickstart.statements.php
To expand...
When you query with php, you are asking for a "result" object (or, to be syntactically correct, a resource). You then need to iterate through the object/array/resource/whatever in order to actually get your data.
Thanks for the pointers to the new scripts,
Have tryied your soulation on the above and get the error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5153944/public_html/update1phone.php on line 4
so tryied
$result = mysql_query("select * from table1 where id=8");
and got a record set, so my thinking is
this is the inputpage.php form
<FORM method=post action=input1.php>
<P><textarea name=id>input number here</textarea><P>
<INPUT value="Submit Query" type=submit>
</P><P></P><P></P><P>
</FORM>
thanks @ryantroop
but since we are all moving to mysqli, this is already horridly outdated.
Check out http://www.php.net/manual/en/mysqli.quickstart.statements.phpHere
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
$res = $mysqli->query("SELECT id, area FROM plate1 WHERE id =('$_POST[id]')");
$row = $res->fetch_assoc();
printf("id = %s (%s)\n", $row['id'], gettype($row['id']));
printf("label = %s (%s)\n", $row['area'], gettype($row['area']));
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.