<form method="POST" action="">
<input type="text" name="T1" value="<?php $x=$_POST["D1"]; echo $x; ?>" size="20" readonly></p>
<input type="text" name="T2" value="<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("evincere",$con);
$s="select*from enquery2 where st_name=$x";
$result=mysql_query($s,$con);
$r=mysql_fetch_array($result);
echo $r['st_address']
?>" size="20" readonly>
<br /><b>Warning</b>: mysql_fetch_array() exp
Page 1 of 13 Replies - 1201 Views - Last Post: 08 September 2012 - 07:11 AM
#1
<br /><b>Warning</b>: mysql_fetch_array() exp
Posted 06 September 2012 - 10:11 PM
Replies To: <br /><b>Warning</b>: mysql_fetch_array() exp
#2
Re: <br /><b>Warning</b>: mysql_fetch_array() exp
Posted 06 September 2012 - 10:47 PM
your query fails. I would stab a guess at some missing spaces in the SQL query.
besides that
- the old mysql extension is outdated, use the more modern PDO or MySQLi extensions instead
- you’re wide open to SQL Injection
- never ever connect as root except for administrative purposes
- separate HTML and PHP, this will make understanding the code much easier
- use spaces and indentation extensively, the PHP engine does not care about them and doesn’t get slower because of that. but your readability increases significantly
besides that
- the old mysql extension is outdated, use the more modern PDO or MySQLi extensions instead
- you’re wide open to SQL Injection
- never ever connect as root except for administrative purposes
- separate HTML and PHP, this will make understanding the code much easier
- use spaces and indentation extensively, the PHP engine does not care about them and doesn’t get slower because of that. but your readability increases significantly
#3
Re: <br /><b>Warning</b>: mysql_fetch_array() exp
Posted 08 September 2012 - 06:27 AM
You are also missing a semi-colon at the end of your last echo statement.
#4
Re: <br /><b>Warning</b>: mysql_fetch_array() exp
Posted 08 September 2012 - 07:11 AM
Honestly, it's just horrible code X 1000
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|