Jump to content

ds111

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by ds111

  1. ok so i took out the ",$db" in the query so now it is $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); and that error went away. so now here's the error: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/public_html/search.php on line 128 Line 128 is: $num = mysql_numrows($query); here's the block of code: $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $query = "SELECT * FROM restaurants WHERE type='$type' $limit"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $num = mysql_numrows($query); //This is line 128! $index = 0;
  2. hey guys so im doing pagination...What am i doing wrong? heres my code: //Begin Pagination if (isset($_GET['pageno'])) { $pageno = $_GET['pageno']; } else { $pageno = 1; } // if $query = "SELECT count(*) FROM restaurants WHERE type='$type'"; $result = mysql_query($query, $db) or trigger_error("SQL", E_USER_ERROR); $query_data = mysql_fetch_row($result); $numrows = $query_data[0]; $rows_per_page = 15; $lastpage = ceil($numrows/$rows_per_page); $pageno = (int)$pageno; if ($pageno > $lastpage) { $pageno = $lastpage; } // if if ($pageno < 1) { $pageno = 1; } // if $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $query = "SELECT * FROM restaurants WHERE type='$type' $limit"; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); $num = mysql_numrows($query); $index = 0; while($num != $index) { $name = mysql_result($sql, $index, "name"); //$address = mysql_result($quer, $index, "address"); $phone = mysql_result($sql, $index, "phone"); $hours = mysql_result($sql, $index, "hours"); $menu = mysql_result($sql, $index, "menu"); $type = mysql_result($sql, $index, "type"); $addr1 = mysql_result($sql, $index, "addr1"); $addr2 = mysql_result($sql, $index, "addr2"); $id = mysql_result($sql, $index, "id"); ?> <table width="503" align="center" class="result"> <tr> <hr color="C9D7F1"> <td width="61" valign="middle"><img src="restpic.gif" alt="" /></td> <td width="122"><p class="th3"><em class="result_name"><?php echo $name; ?></em><br /> <?php echo "$addr1, $addr2"; ?><br /> <a href="javascript:popUp_large('directions.php?daddr=<?php echo "$addr1, $addr2"; ?>');">Directions</a></p></td> <td width="114"><p class="th3"><strong>Hours of Operation:<br /> </strong><?php echo $hours; ?></p></td> <td width="137"><p class="th3"> <a href="listing.php?id=<?php echo $id; ?>#description">Description</a><br /> <?php if($menu == "no") { // DO NOTHING } else { ?> <a href="<?php echo $menu; ?>" target="_blank">Menu</a> <br/> <?php } ?><a href="javascript:alert("For Reservations please call 1-800-566-3921");">Reservations</a><br /> <a href="preparepromo.php?promoname=<?php echo $id; ?>" target="_blank">Promotions</a></p></td> </tr> </table> <?php $index++; } if ($pageno == 1) { echo " FIRST PREV "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1'>FIRST</a> "; $prevpage = $pageno-1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'>PREV</a> "; } // if echo " ( Page $pageno of $lastpage ) "; if ($pageno == $lastpage) { echo " NEXT LAST "; } else { $nextpage = $pageno+1; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'>NEXT</a> "; echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage'>LAST</a> "; } // if //End Pagination The error i get is: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/public_html/search.php on line 111 Fatal error: SQL in /home/public_html/search.php on line 111 Line 111: $result = mysql_query($query, $db) or trigger_error("SQL", E_USER_ERROR); any help is appreciated. thanks
  3. ugh! i need it in php! so i can get a certain number lets say 123456789012 from the DB and make a barcode out of that. seriously is it too much to ask for? how come no one has it on a website? Sheesh!! seriously these people do not like to explore or anything!! lol
  4. easy: <script> function doStuff() { return false; history.go(-1); } </script> <a href=javascript:alert("Text goes here."); onclick=doStuff()>Link text goes here.</a> im really sleepy/tired so i might have added an extra ; or maybe left out a ; but u get the point
  5. well i just need to know how to make a barcode! i dont care if its HTML, PHP, or Javascript, just one of the three. any ideas?
  6. Anyone know where i can get this? I've searched all over the place and could only find the "AJAX and Javascript Barcode Generator 2007" which is only for pay. Any one can please help me find it? ??? Thanks!! I have, actually, found this: http://www.parkscomputing.com/barcode.html but i cant get the source code. So, can anyone help me? Thansk!
  7. ThankS Youso much! You my hewro!! :D !!! Thanlks again!
  8. i know i saw that all ready but i dont need all that. all i need is just a simple link so that the to and from address are already typed into google maps. I dont mind that it opens another window and has Google Maps there.
  9. hey guys! So i have a question thats got me stumped ??? So basically what i want to do is have a dynamic link saying something like this: http://maps.google.com?to=<?php echo $to; ?>&from=<?php echo $from; ?> that all works fine i've done it all before....but not with google maps. Does anyone know the two variables in google maps that it uses for the TO and FROM variables? Uhh, i feel like im not making it clear is the "TO" variable TO or A or 1 or..... like i mean this: http://maps.google.com?to=<?php echo $to; ?>&from=<?php echo $from; ?> Im not sure if those are the ones that google maps uses. Can anyone help me? If u need more clarification i'll try my best thanks
  10. it not working. here is screenshot: it shows '1' for some reason. and shows the login form in header. why?
  11. Hi guys! great forum! ok well i need help with this i've tried google and everything. this is what i have: i have a template.php where the heading and body are dynamic (this is a css template) so basically i have the html and everthing and where the heading or content usually is, i put <php echo $heading; ?> and same for body. now for login.php, this is what i have. $heading = 'Login'; <-- works $body = "include 'login_form.php';"; <--- doesn't work include 'template.php'; <---works so how do i do an include statement in a variable? thanks for any answers!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.