Jump to content

meamrussian

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

meamrussian's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am building a project and learning PHP/MySQL at the same time. Here is my code: $query = "SELECT suite, title, category, our_url FROM business ORDER BY category ASC"; $result = mysql_query($query); $num_results = mysql_num_rows($result); <table width="100%"> <tr><td width="63"><u>Suite</u></td><td><u>Business</u></td><td><u>Category</u></td><td> <u>Link</u></td></tr> <? for ($i=0; $i <$num_results; $i++) { $row = mysql_fetch_array($result); echo "<tr><td>"; echo htmlspecialchars(stripslashes($row["suite"])); echo "</td><td>"; echo htmlspecialchars(stripslashes($row["title"])); echo "</td><td>"; echo htmlspecialchars(stripslashes($row["category"])); echo "</td><td>"; echo htmlspecialchars(stripslashes($row["our_url"])); echo "</td></tr>"; } ?> </table> I am getting the following error: ===== Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in [b]my directory[/b] on line 47 ===== I have already connected to my database. I am using PHP 4. Also, even if I try to replace mysql_num_rows($result) with "2" , I get the same errors except with mysql_fetch_array(): . Why is this happening? Thanks.
  2. I fixed it by doing this: $page.= $_GET['page']; $page.= $_POST['page']; Thanks for the help.
  3. Aha! That's the problem. It's using global variable. However, there is another part in the script that uses $post with POST instead of GET. How can I put them both in? I can't just put in $page = $_GET['page']; $page = $_POST['page']; How can I use both? Thanks.
  4. Sorry about the undescriptive title. I couldn't think of the name of my problem. I bought a MySpace friend train script, and I seem to be getting a problem. [a href=\"http://www.mshangout.com/train/index.php\" target=\"_blank\"]http://www.mshangout.com/train/index.php[/a] This is the error: [code]Warning: main(pages/.php): failed to open stream: No such file or directory in /home2/meamruss/public_html/train/pages.php on line 11[/code] This is line 11: include "pages/" . $page . ".php"; Throughout the whole script files, there is no such variable $page. However, the index page has only the following content: <meta http-equiv="refresh" content="0;url=pages.php?page=home"> I'm guessing that "home" is $page in this case. The header (Home Page | Join the Train | What is the Train?) links have this format: <a class="link_whitetored" href="pages.php?page=faq">FAQ</a> Obviously, it assumes that it should load what's after the = for $page. But why isn't it reading what's after this = sign? It's just giving me pages/.php. Sorry if that was confusing. Thanks in advance.
×
×
  • 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.