Jump to content

samsbc12

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

Posts posted by samsbc12

  1. I am trying

     

    if ($REQUEST_METHOD=="POST")

      {

        mysql_query('REPLACE INTO info_comments (Id, Text, isOn) VALUES (1, "'.mysql_escape_string($aboutus).'", $isOn)')

              or die(mysql_error());

      }

    a

    but I get error

     

    Unknown column '$isOn' in 'field list'

     

    any ideas

  2. I am trying

     

    if ($REQUEST_METHOD=="POST")

      {

        mysql_query('REPLACE INTO info_comments (Id, Text, isOn) VALUES (1, "'.mysql_escape_string($aboutus).'", $isOn)')

              or die(mysql_error());

      }

     

    but I get error

     

    Unknown column '$isOn' in 'field list'

     

    any ideas

  3. define('TEXT_MAIN', '<style type="text/css">

    <!--

    .style4 {font-size: small}

    --><br>

    <!--

        p {

          text-indent: 2.0em;

        }

      -->

    </style>

    <div align="left">

      <p>

      <img src="/images/mainpage.jpg" hspace="15" align="left">' . str_replace("\r\n", "<br>", stripslashes($row['Text']))  //i WANT TO INSERT THIS FUCTION HERE THEN CONTINUE THE STRING

      </div>

    </html>

    ');

  4. I have no idea, but your grammar makes it very hard to understand.

     

    I think you mean "to no avail".

    know is something you do with knowledge. No is the opposite of yes.

    prevail is something that keeps on going, avail is something of use.

     

    I am sorry and Thank you very much for correcting me, I mean it too. I always want to try and better myself, I do not want to sound like an idiot.

     

    Basically what I want to do is see if the site is on a https connection vs http so that I can act accordingly.

  5. I want to display information if and only if the page is a secure connection

     

    i have been trying

    if(substr($_SERVER["SCRIPT_URI"],0,5)!=='https'){
    echo "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\">
    </script>
    <script type=\"text/javascript\">
    _uacct = \"UA-1\";
    urchinTracker();
    </script>";
    }
    ?>
    

    to know prevail not sure if my firewall is blocking stuff and if thats the case I need a php code that won't be blocked by firewalls

  6. basically what i have done is I have a latests news box on the side of my site

    I can add an entry but I want to recall the last one entered and display the info

    <?
    include("dbinfo.inc.php");
    $result = mysql_query("SELECT FROM LatestNews  WHERE ID = MAX(ID);") //Pulls contact submissions
    or die(mysql_error()); 
    while($row = mysql_fetch_array( $result )) {
      echo "<h2> ";
      echo $row['date'];
    echo "</h2>";
        echo "<p>";
      echo $row['message'];
      echo "</p>";
      }
      mysql_close();
    ?>

    Gives me
    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM LatestNews WHERE ID = MAX(ID)' at line 1

    I have no idea what i am doing

    I am using sql version Client API version  4.0.27 

    Aslo a side note when ever i echo a variable in a double qouted string i get errors any ideas

  7. [!--quoteo(post=377655:date=May 27 2006, 04:28 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ May 27 2006, 04:28 PM) [snapback]377655[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    An easier way is
    [code]
    $res = mysql_query("SELECT category, COUNT(*) as total
            FROM links
            GROUP BY category
            HAVING total = 1");

    while (list($category, $total) = mysql_fetch_row(res)) {
        echo "<a href =\"resouces.php?cat=$category\">$category</a><br>";
    }
    [/code]
    [/quote]


    what would that replce in my code, i am having a little trouble

    I got it working excpet it only displays categories who only have one item in it as opposed to displaying only one category once


    I took out HAVING total = 1");
    and it works great now thanks a bunch
  8. So let me see if i can explain this what i want to do is go through my table and pull all categories that are not doubles and then sort them alphabetically.

    [code]<?
                      $username="******";
                      $password="******";
                      $database="******";
                      
                      mysql_connect(localhost,$username,$password);
                      @mysql_select_db($database) or die( "Unable to select database");
                      $query="SELECT * FROM links";
                      $result=mysql_query($query);
                    
                      //Count Number of rows in table
                      $num=mysql_numrows($result);
                          
                      //Close Connection
                        mysql_close();
                      //loop through
                      //Echo categories
                    $i=0;
                    
                      while ($i < $num) {
                          $c = $i +1;
                        $category=mysql_result($result,$i,"category");
                       while ($c < $num) {
                        $category2=mysql_result($result,$c,"category");
                             if($category == $category2){
                                $double = "true";        
                            }
                            $c++;
                            }
                         if($double != "true"){    
                           echo "<href =\"resouces.php?cat=$category\">$category</a>";
                        }
                          $double ="";
                        
                     $i++;
                    }
                      
                    //End Category Echo
    [/code]

    that will echo that categories, I realize I will probably have to store them in some kind of list then sort any suggest as to where to go from here?
  9. [code]<?
    //Store username and pass
    $username="*******";
    $password="*******";
    $database="*******";

    //Variables
    //Pulls From Form
    $id=$_POST['id'];
    $category=$_POST['category'];
    $name=$_POST['name'];
    $description=$_POST['description'];
    $link=$_POST['link'];
    $mirror=$_POST['mirror'];

    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");

    if($name != ""){

    $query = "UPDATE links SET category='$category', name='$name', description='$description', link='$link',  mirror='$mirror' WHERE id='$id' ";

    mysql_query($query);
    mysql_close();
    echo"<html>
    <title>Addedt</title>
    <style type=\"text/css\">
    <!--
    body {
        background-color: #666666;
    }
    -->
    </style></head>

    <body>
    <div align=\"center\"><font color=\"#FFCC00\" face=\"Arial, Helvetica, sans-serif\">Record Updated. </font></div>
    </body>
    </html>
    ";



    }?>
    <meta http-equiv="refresh" content="2;URL=************">[/code]
  10. [!--quoteo(post=377380:date=May 26 2006, 03:02 PM:name=freakus_maximus)--][div class=\'quotetop\']QUOTE(freakus_maximus @ May 26 2006, 03:02 PM) [snapback]377380[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    You have a mispelling in this bit of code.

    Change this:

    [code] $id = mysel_result($result, $i, "id");[/code]

    to this:

    [code]$id = mysql_result($result, $i, "id");[/code]

    Other than that I did not see anything else wrong.
    [/quote]


    thanks man i didnt even see that, is there a way to get php to echo the errors when the page doesnt load?
  11. This is the display page and when you click the edit link it opens up the edit.php but i can not get the text to display in the form of the edit page

    [code]<?
                      $username="******";
                      $password="******";
                      $database="******";

                      mysql_connect(localhost,$username,$password);
                      @mysql_select_db($database) or die( "Unable to select database");
                      $query="SELECT * FROM links";
                      $result=mysql_query($query);
                    
                      //Count Number of rows in table
                      $num=mysql_numrows($result);
                          
                      //Close Connection
                        mysql_close();
                      //loop through
                      $i=0;
                      while ($i < $num) {
                         $id=mysql_result($result,$i,"id");
                        $category=mysql_result($result,$i,"category");
                        $name=mysql_result($result,$i,"name");
                        $description=mysql_result($result,$i,"description");
                        $link=mysql_result($result,$i,"link");
                        $mirror=mysql_result($result,$i,"mirror");
                        
                        echo "<b>Category:</b> $category <br>
                        Title: $name<br>
                        Description: $description<br>
                        <a href =\"$link\"> -Link-</a>";
                        if($mirror != ""){
                        echo"<a href =\"$mirror\"> -mirror-</a>";    
                        }
                        echo"<a href =\"edit.php?id=$id\"> -Edit-</a>";
                        echo"<br><br>";

                     $i++;
                    }
                      ?>[/code]

    edit.php
    [code]

    id does however display because its passed in the url

    <?
                      $id=$_GET['id'];
                       $username="******";
                      $password="******";
                      $database="******";

                      mysql_connect(localhost,$username,$password);
                     @mysql_select_db($database) or die( "Unable to select database");
                    
                     $query=" SELECT * FROM links WHERE id='$id'";
                    
                        $result=mysql_query($query);
                        $num=mysql_numrows($result);
                        mysql_close();
                        
                        $i=0;
                        while ($i < $num) {
                        $id = mysel_result($result, $i, "id");
                        $category=mysql_result($result,$i,"category");
                        $name=mysql_result($result,$i,"name");
                        $description=mysql_result($result,$i,"description");
                        $link=mysql_result($result,$i,"link");
                        $mirror=mysql_result($result,$i,"mirror");
                        
                          ++$i;
                        }

                      
                      ?>
                        
                        
                      
                      <form action="update.php" method="post">
                        <div align="left"><br>
                          <br>
                          <br>
                          <table width="730" border="0">
      <tr>
        <td align="right" valign="top"><strong>Id: </strong></td>
        <td valign="top"><input type="text" disabled="disabled"  name="id" value="<? echo $id; ?> "></td>
      </tr>
      <tr>
        <td align="right" valign="top"><strong>Category: </strong></td>
        <td valign="top"><input name="category" type="text" value="<?  $category; ?>"></td>
      </tr>
      <tr>
        <td align="right" valign="top"><strong>Name: </strong></td>
        <td valign="top"><input type="text" name="name"  value="<? echo $name; ?>"></td>
      </tr>
      <tr>
        <td align="right" valign="top"><strong><br>
          Description: </strong></td>
        <td valign="top"><textarea name="description" cols="40" rows="8"  ><? echo $description; ?></textarea></td>
      </tr>
      <tr>
        <td align="right" valign="top"><strong>Link: </strong></td>
        <td valign="top"><input type="text" name="link" value="<? echo $link; ?>"></td>
      </tr>
      <tr>
        <td align="right" valign="top"><strong>Mirror: </strong></td>
        <td valign="top"><input type="text" name="mirror" value="<? echo $mirror; ?>"></td>
      </tr>
      <tr>
        <td align="right" valign="top">&nbsp;</td>
        <td valign="top"><input name="Submit" type="Submit"></td>
      </tr>
    </table>
                          <br>
    <br>
                        </div>
                      </form>[/code]
×
×
  • 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.