Reply to Re: Not finding results

Your name:

Reply:


Posted by J.O. Aho on 02/04/06 16:38

UKuser wrote:
> I'm sure this is something really simple, but the below code isnt
> returning my basic mySQL results - I know the data is in there, and if
> I use a value instead of $price in PHPbuilder it does return a value.

> function result_get()
> {
> $query = "SELECT result FROM fig_lookup WHERE $price BETWEEN
> lowerval AND upperval";
> $result = mysql_query($query);
> check_mysql();
> }

You have defined a function, as long as the function isn't executed, it won't
do anything.

The function has a major disadvantage, it don't return a value or use a global
value, so even if it's executed, the $result you have in the

<input type="text" name="outcome" <?php echo "VALUE=\"$result\"" ?>>

isn't the same as the $result in your result_get().

for the second, the $result (return value from mysql_query()) isn't the actual
output from the sql query, it's a resource used to access the data you want.

$date=mysql_fetch_array($result);
?>
<input type="text" name="price">
<input type="submit" value="hit me">
<input type="text" name="outcome" <?php echo "VALUE=\"$date['result']\"" ?>>
</form>

mysql_fetch_array() does return an array of the columns for _one row_ data
from the query you have made. If you want to get out more than one row you
need to use the function more than once.


Look at these pages:
http://www.php.net/manual/en/function.mysql-fetch-array.php
http://www.php.net/manual/en/function.mysql-query.php
http://www.php.net/manual/en/language.functions.php


//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация