Announcement

Collapse
No announcement yet.

problem=(

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem=(

    ok ive been trying to get this to work all day and i havent gotten it to work yet.

    heres the link to the file: http://www.animationation.net/testin.php

    im trying to extract some info from a table in a db but its not working

    heres the code im using
    PHP Code:
    1:<?php
    2
    :
    3:$connectionmysql_connect(localhost,username,pass);
    4:$db="database"
    5:mysql_select_db($db);
    6:$query="SELECT * FROM xtd";
    7:$info mysql_query($db,$query,$connection); 
    8:while($object mysql_fetch_object($info)){
    9:$rank=$object->rank;}
    10:echo"<html>";
    11:echo"<body>";
    12:echo"<b>$rank</b>";
    13:echo"</body>";
    14:echo"</html>";
    15:
    16:?>
    i used username,pass, and database to hide my real info so dont say i should not have those there cause i know about em, but i dont get y it doesnt work. it keeps saying error on line 5

  • #2
    if that's an exact copy paste...

    Line 4: $db="database"
    You need

    $db="database";

    (notice the -> ; at the end of the line )

    Hope this helps

    Comment


    • #3
      Line 4, you've missed an ;

      Comment


      • #4
        doh, you beat me too it Babylon

        Comment


        • #5
          omg i missed dat lol, lets see if it works now

          now im getting this:
          Warning: Wrong parameter count for mysql_query() in /home/anima823/public_html/testin.php on line 7

          Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/anima823/public_html/testin.php on line 8

          Comment


          • #6
            $info = mysql_query($db,$query,$connection);

            to

            $info = mysql_query($query,$connection);

            No need to pass $db to it.

            Comment


            • #7
              ok now it says 5, hmm not exactly wut i wanted to be displayed

              PHP Code:
              require("config.php");

              if(
              $_GET["id"]){

              $query mysql_query("SELECT * FROM $table WHERE memberid = '".$_GET["id"]."'") or die(mysql_error());
              while(
              $object mysql_fetch_object($query)){
              $rank $object->rank;

              $days $object->date;
              $days explode(" | ",$days);

              $daytoday $days[0];
              $dayplus $days[1];
              $dayplus $dayplus 1;

              if(
              $date != $daytoday){ $c "UPDATE $table SET date = '$date | $dayplus' WHERE memberid = '".$_GET["id"]."'"; }
              elseif(
              $date == $daytoday) { }

              if(
              $daytoday != $date){ mysql_query($c) or die(mysql_error()); } 
              im trying to get multiple info from a table like this on is, one for each user registered.

              Comment


              • #8
                *edit* Forget it, i have no idea what's happening
                Last edited by Babylon; Sun 2nd Nov '03, 10:24am.

                Comment


                • #9
                  new problem=(
                  http://www.animationation.net/testin4.php

                  Comment


                  • #10
                    Originally posted by sweet22
                    Would you mind copy/pasting the whole script?

                    Comment


                    • #11
                      i fixed it

                      Comment

                      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                      Working...
                      X