You are here: Create new function for a select statement - TIA « PHP SQL « IT news, forums, messages
Create new function for a select statement - TIA

Posted by Dekka-X on 12/08/06 20:03

I want to call the following query from a function :

$sql2 = "SELECT * from session limit 1";
$result_thread = mysql_query($sql2, $conn);

while ($row3 = @mysql_fetch_array($result_thread)){
$sthread=$row3['thread'];
$slevel=$row3['level'];
}


The above code works fine in the program.

When I create a function I get the error:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link
resource


The function code I was trying to use is here. (bonus points for
telling me what idiotic mistake I'm making) >>>.

function search_session(){
$sql2 = "SELECT * from session limit 1";
$result_thread = mysql_query($sql2, $conn);

while ($row3 =
@mysql_fetch_array($result_thread)){
$sthread=$row3['thread'];
$slevel=$row3['level'];
return $sthread;
return $slevel;
}
}

 

Navigation:

[Reply to this 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

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