I have myTable like the above.
I like to get the text “myText2” which is in (2) in php.
The following is trial code for it. And it causes an error.
<?
$connect=mysql_connect("localhost","root","******");
?>
<?php
$mysql=mysql_select_db("php02",$connect);
?>
<?php
$query="select say from myTable where n=2;
?>
You haven’t properly closed that last string. See below, I’ve added a double quote in bold red:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>test05</title>
</head>
<body>
<?php
$connect=mysql_connect("localhost","root","******");
$mysql=mysql_select_db("php02",$connect);
$query="select say from adText where n=2[B][COLOR="Red"]"[/COLOR][/B];
?>
</body>
</html>
Also, there is no reason to go in and out of PHP all the time, so I just made one big PHP block.
Lastly, like Kalon said, you still need to run the query using [fphp]mysql_query[/fphp] and then get the results using [fphp]mysql_fetch_array[/fphp] or [fphp]mysql_fetch_assoc[/fphp] or any of the other mysql_fetch_* functions.