Iconate Posted May 25, 2009 Share Posted May 25, 2009 Hey everyone, I have been working on a project which requires me to use PHP/MySQL, and I have been teaching myself along the way, but I am currently having some function calling issues, and I am not sure if its just syntactical or what. Essentially Im just trying to create a table, but some of the columns are dynamic, my solution to that is to have function calls, but first I need to figure out how to actually do them properly <?php function print() { echo "<table border='1'>"; echo "<tr>"; echo "<th>Time</th>"; echo "<th>Availablility</th>"; echo "</tr>"; echo "<tr><td>08:00</td></tr>"; echo "<tr><td>09:00</td></tr>"; echo "<tr><td>10:00</td></tr>"; echo "</tr>"; echo "</table>"; } $q=$_GET["q"]; $con = mysql_connect('....'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("....", $con); $a = $q[0]; $q = substr($q, 1, 11); $sql="SELECT * FROM dates WHERE arena = '".$a."' AND date LIKE '%".$q."%'"; $result = mysql_query($sql); $dbtime = "NULL"; print(); mysql_close($con); ?> When I run this along with my other files, the page does not display what is in the "print()" function, but if I just take what is in that function and hardcode it, it does get displayed. Thanks, sorry if this is such a trivial error Quote Link to comment https://forums.phpfreaks.com/topic/159526-function-calling-understanding/ Share on other sites More sharing options...
Maq Posted May 25, 2009 Share Posted May 25, 2009 You need to change the function name, print() is a native function in PHP. Quote Link to comment https://forums.phpfreaks.com/topic/159526-function-calling-understanding/#findComment-841487 Share on other sites More sharing options...
Iconate Posted May 25, 2009 Author Share Posted May 25, 2009 *facepalm* Well it works now heh, thanks, so much for my stupid arbitrary test names..... Quote Link to comment https://forums.phpfreaks.com/topic/159526-function-calling-understanding/#findComment-841490 Share on other sites More sharing options...
Maq Posted May 25, 2009 Share Posted May 25, 2009 *facepalm* Well it works now heh, thanks, so much for my stupid arbitrary test names..... Lol, next time you have problems and can't figure it out what's going on, you can enable heavy error reporting right after your opening <?php tag to rule out 'simple' mistakes. ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/159526-function-calling-understanding/#findComment-841491 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.