Jump to content

ludjer

Members
  • Posts

    60
  • Joined

  • Last visited

Posts posted by ludjer

  1. Before sqlsafe: INSERT INTO `mainp_com` (`newsid` , `userid` , `comment` , `time` , `date1`) VALUES (`9`, `2`, `i am the most l337 of them all`, `04:05:41 AM`, `October 7 2007`);
    After sqlsafe: INSERT INTO `mainp_com` (`newsid` , `userid` , `comment` , `time` , `date1`) VALUES (`9`, `2`, `i am the most l337 of them all`, `04:05:41 AM`, `October 7 2007`);
    
    A fatal MySQL error occured.
    Query: INSERT INTO `mainp_com` (`newsid` , `userid` , `comment` , `time` , `date1`) VALUES (`9`, `2`, `i am the most l337 of them all`, `04:05:41 AM`, `October 7 2007`);
    Error: (1054) Unknown column '9' in 'field list'
    if this error happens again and you dont know what is wrong please email

    And why would your set your ID column to null?? its a waste of space but you can do it if you want, also that is how phpmyadmin gives it to you.

  2. if you have a look it says Unknown column '9' in 'field list', this means that the error comes after the null it comes in with newsid

     

    here is the structure of my sql database

    CREATE TABLE `mainp_com` (
      `ID` int(11) NOT NULL auto_increment,
      `newsid` int(11) NOT NULL,
      `userid` int(11) NOT NULL,
      `comment` mediumblob NOT NULL,
      `time` varchar(10) collate latin1_general_ci NOT NULL,
      `date1` varchar(20) collate latin1_general_ci NOT NULL,
      PRIMARY KEY  (`ID`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=9 ;

  3. there cant be a typo cause this sql query works when i run it using phpmyadmin

    INSERT INTO `mainp_com` ( `ID` , `newsid` , `userid` , `comment` , `time` , `date1` )

    VALUES (

    NULL , '9', '54', 'this works when i use phpmyadmin', '2:35 am', ' October 7 2007'

    );

    and i copy it directly into my php code and edit the values

  4. when i try run one sql query i get a error

    here is the sql query, it works in phpmyadmin when i run it

    INSERT INTO `mainp_com` ( `ID` , `newsid` , `userid` , `comment` , `time` , `date1` )
    VALUES (
    NULL , '9', '2', 'woot this is a 1337 test', '03:16:06 AM', 'October 7 2007'
    );

     

    this is the out put i get, i have my own custom error printing

    A fatal MySQL error occured.

    Query: INSERT INTO `mainp_com` (`ID` , `newsid` , `userid` , `comment` , `time` , `date1`) VALUES (NULL, `9`, `2`, `i am the most l337 of them all`, `03:36:40 AM`, `October 7 2007`);

    Error: (1054) Unknown column '9' in 'field list'

    if this error happens again and you dont know what is wrong please email

     

    now for the php code

     

    <?php
    include "functions.php";
    if (isset($_GET["nid"])) $nid = $_GET["nid"];
    
    else die("error");
    if (isset($_POST['submit'])){
    $comment = $_POST["comment"];
    if($comment == null)
    {
    	die("error please input somthing into the comment box");
    }
    $userid = $user->data["user_id"];
    $time = date("h:i:s A");
    $date = date("F j Y");
    $comment = htmlspecialchars($comment);
    $sql = 'INSERT INTO `mainp_com` (`ID` , `newsid` , `userid` , `comment` , `time` , `date1`) VALUES (NULL, `'.$nid.'`, `'.$userid.'`, `'.$comment.'`, `'.$time.'`, `'.$date.'`);';
    $qur = sql_safe($sql);//custome function
    
    mysql_query($qur)or die(sqlerr($qur,mysql_error(),mysql_errno()));
    }else{
    	die("error");
    	}
    ?>

     

    thanks in advance

  5. i am trying to insert some info into a mysql database but it just wont work :(

    <?php
    include "lastRSS.php";
    function connect()
    {
    $username="root";
    $password="";
    $database="rssreader";
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    }
    function rsstosql($url,$table)
    {
    connect();
    $rss = new lastRSS;
    $rss->cache_dir = './temp';
    $rss->cache_time = 1200;
    if ($rs = $rss->get($url)) {
    	$time;
    	foreach($rs['items'] as $item) {
    			if ($item['description']==null)
    			{	
    				$time = $item['title'];
    			}else{
    				$title = substr($item['title'],2);
    				$desc = $item['description'];
    				$sql = "INSERT INTO `$table` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, $time, $title, $desc, null)";
    				echo $sql."<br>";
    				mysql_query($sql);
    				}
    
    		}	
    
    	}
    else {
    die("Error: It's not possible to reach RSS file...\n");
    }
    mysql_close();
    }
    rsstosql('http://www.tvrage.com/myrss.php',"showstoday");
    ?> 

    also this is what the SQL query's say

    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 08:00 pm, Deal Or No Deal (US) (02x68), Episode 107, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 08:00 pm, On the Lot (01x05), 1 of 15 Directors Voted Off, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:00 pm, Deadliest Catch (03x10), Trials of the Greenhorns, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:00 pm, Punk'd (S08-Special), Punk'd Awards, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:00 pm, America's Got Talent (02x01), Episode 201, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:00 pm, The Universe (01x02), Mars: The Red Planet, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:00 pm, ALMA Awards (01x07), 2007 ALMA Awards, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:00 pm, Decorating Cents (01x01), Decorating Cents Dream Wedding, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:30 pm, Dog the Bounty Hunter (04x13), Fly Boy, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 09:30 pm, Scarred (01x09), Season 1, Episode 9, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, Kathy Griffin: My Life on the D-List (03x01), Season Opener, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, The Real World/Road Rules Challenge (14x11), Pane In The Glass, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, The Shield (06x10), Spanish Practices, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, Criss Angel: Mindfreak (03x01), Luxor Light, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, Secret Lives Of Women (03x05), Lipstick Lesbians, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, America's Got Talent (02x02), Episode 202, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, ECW on Sci Fi (02x23), June 5, 2007, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, Whose Wedding Is It Anyway? (US) (06x08), Now You May Kiss the...Groom?, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, Jon & Kate Plus 8 (01x08), Shopping for Ten, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:00 pm, After The Catch (01x02), Man vs. Nature, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:30 pm, Rob & Big (02x03), Season 2, Episode 3, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:30 pm, Spice Up My Kitchen (01x01), Kitchen Needs to Get Current, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 10:30 pm, Hollyoaks (12x181), Student Balls, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 11:00 pm, The Daily Show (12x74), Paul Rudd, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 11:00 pm, The Springer Hustle (01x08), Season 1, Episode 8, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 11:30 pm, The Colbert Report (03x74), Jessica Valenti, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 11:35 pm, Late Show with David Letterman (14x156), Chevy Chase, Amanda Beard, Satellite Party, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 11:35 pm, The Tonight Show with Jay Leno (15x166), George Clooney, senior-citizen band the Zimmers, Rihanna, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 12:35 am, Late Night with Conan O'Brien (14x148), Brian Williams, Leslie Mann, Los Straitjackets with Big Sandy, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 12:35 am, The Late Late Show with Craig Ferguson (03x90), Rosie Perez, David Milch, Patti Smith, null)
    INSERT INTO `showstoday` (`ID`, `time`, `name`, `title`, `link`) VALUES (NULL, 01:35 am, Last Call with Carson Daly (06x66), Andy Richter, Gary Jules, null)
    

    thx in advance

  6. i dont get it

    here is my new code
    and its still not getting newsid
    still the same problem
    [code]<?php
    require_once('config/database.php');
    $amount = '5';
    if (isset ($_GET['newsid']))
    {
    $_GET['newsid']= $newsid;
    $newsid = mysql_real_escape_string(trim($_GET['newsid']));
    echo $newsid;
    echo $amount;

    }
    else {
    $amount = '5';
    $result = mysql_query("SELECT * FROM news LIMIT $amount");

    while ( $row = mysql_fetch_array($result) )
    {?>

    <div style="width:450px;">

    <h3><u><?php echo @$row['title']; ?></a></u></h3>
    <p><?php echo nl2br(@$row['content']); ?></p>
    <p><b>Posted On:</b><i><?php echo @$row['date']; ?> by <?php echo @$row['user']; ?></i></p><br />
    <hr />

    </div>
    <?php
    }
    }?>[/code]
  7. OK here is my problem
    i type in a "file.php"
    and it does the loo of the sql database
    but now when use this "file.php?newsid=11"
    a blank screen comes up
    i want it to echo $newsid but it wont
    it will echo amount but no id
    if any1 can help me i would really be happy

    heres my code
    [code]<?php
    require_once('config/database.php');
    $amount = '5';
    if (isset ($_GET['newsid']))
    {
    $_GET['newsid']= $newsid;
    $newsid= $_GET['newsid'];
    echo $newsid;
    echo $amount;

    }
    else {
    $amount = '5';
    $result = mysql_query("SELECT * FROM news LIMIT $amount");

    while ( $row = mysql_fetch_array($result) )
    {?>

    <div style="width:450px;">

    <h3><u><?php echo @$row['title']; ?></a></u></h3>
    <p><?php echo nl2br(@$row['content']); ?></p>
    <p><b>Posted On:</b><i><?php echo @$row['date']; ?> by <?php echo @$row['user']; ?></i></p><br />
    <hr />

    </div>
    <?php
    }
    }?>[/code]

    thx
    ludger
  8. hi
    os: Linux redhat9 or ubuntu-6.06.1

    i would like to know the diffrence between running a xampp server that comes with
        - Apache 2.2.2
        - MySQL 5.0.21
        - PHP 4.4.2
        - PHP 5.1.4
        - Perl 5.8.7
        - ProFTPD 1.3.0
        - phpMyAdmin 2.8.1
        - OpenSSL 0.9.8b
        - GD 2.0.1
        - Freetype 2.1.7
        - libjpeg 6b
        - libpng 1.2.7
        - gdbm 1.8.0
        - zlib 1.2.3
        - expat 1.2
        - Sablotron 1.0
        - libxml 2.6.11
        - libxslt 1.1.8
        - Ming 0.3
        - Webalizer 2.01
        - pdf class 009e
        - ncurses 5.8
        - mod_perl 2.0.2
        - FreeTDS 0.63
        - gettext 0.11.5
        - IMAP C-Client 2004e
        - OpenLDAP (client) 2.3.11
        - mhash library 0.8.18
        - mcrypt library 2.5.7
        - cURL 7.13.1
        - SQLite 2.8.17 (for PHP4 + PHP5)
        - SQLite 3.2.8 (for PHP5 PDO SQLite)
        - phpSQLiteAdmin 0.2
        - libapreq 2.07
        - eAccelerator 0.9.4
        - FPDF 1.53


    or running normaly server with majority of the things listed above ??

    if i take xampp will it use more proccesor speed
    what are the pros and cons of xampp

    btw this is for a server hosting 1 site

    thx
    ludger
  9. here is my code
    [code]
    <?php
    require_once('../config/database.php');
    require_once('../config/newschecksesion.php');

    $result = mysql_query("SELECT * FROM news");

    while ( $row = mysql_fetch_array($result) )
    {?>

    <div style="width:450px;">

    <h3><u>title:<br />
    <?php echo @$row['title']; ?></u></h3>
    <p>content:<br />
    <?php echo @$row['content']; ?></p>
    <p><b>Posted On:</b><i><?php echo @$row['date']; ?> by <?php echo @$row['user']; ?></i></p>
    <hr />

    </div>


    <?php }?> [/code]

    now how do i only read the latest rows that where put into the database

    thx
    ludger
  10. yip
    it says

    Failed to upadate, Reason for failing
    No database selected

    and if i do put quots around it then
    Failed to upadate, Reason for failing
    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 ''club_data' SET Head='sanan', Teacher='none', News='noneeen',
    Message='noneoneo'' at line 1
  11. [code]<?php
    /*session checker */
    if (!isset($_SESSION)) {
      session_start();
    }
    $MM_authorizedUsers = "";
    $MM_donotCheckaccess = "true";

    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
      // For security, start by assuming the visitor is NOT authorized.
      $isValid = False;

      // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
      // Therefore, we know that a user is NOT logged in if that Session variable is blank.
      if (!empty($UserName)) {
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
        // Parse the strings into arrays.
        $arrUsers = Explode(",", $strUsers);
        $arrGroups = Explode(",", $strGroups);
        if (in_array($UserName, $arrUsers)) {
          $isValid = true;
        }
        // Or, you may restrict access to only certain users based on their username.
        if (in_array($UserGroup, $arrGroups)) {
          $isValid = true;
        }
        if (($strUsers == "") && true) {
          $isValid = true;
        }
      }
      return $isValid;
    }

    $MM_restrictGoTo = "login.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) { 
      $MM_qsChar = "?";
      $MM_referrer = $_SERVER['PHP_SELF'];
      if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
      if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
      $MM_referrer .= "?" . $QUERY_STRING;
      $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
      header("Location: ". $MM_restrictGoTo);
      exit;
    }
    ##club veryfiyer
    if (isset($_GET['club'])) $club = $_GET['club'];

    else $club = 'error';
    $error='no';

    switch ($club) {

    case 'error':
    $error='yes'; 
    break;

    case '1':
    $clubno='1'; 
    break;
    case '2':
    $clubno='2'; 
    break;
    case '3':
    $clubno='3'; 
    break;

    default:
    $error='yes';
    break;
    }

    $hostname_intranet = "localhost";
    $database_intranet = "intranet";
    $username_intranet = "root";
    $password_intranet = "jam3s0n";

    $intranet = mysql_pconnect($hostname_intranet, $username_intranet, $password_intranet) or trigger_error(mysql_error(),E_USER_ERROR);
    mysql_select_db($club_data, $intranet);

    if(isset($_POST['Submit_1']))
    {

        $gethead = $_POST['head'];
    $getteacher = $_POST['teacher'];
    $getnews = $_POST['news'];
    $getmessage = $_POST['message'];
    $getmembers = $_POST['members'];
    $error = "";

        if($gethead =="") $error.="*Please enter a head"."<br>";
    if($getteacher=="") $error.="*Please enter a Teacher"."<br>";
    if($getnews=="") $error.="*Please enter some news"."<br>";
    if($getmessage=="") $error.="*Please enter a message"."<br>";
    if($getmembers=="") $error.="*Please enter the members of this club"."<br>";

    if(isset($error))
        {
            $sqlqup= "UPDATE 'club_data' SET Head='$gethead', Teacher='$getteacher', News='$getnews', Message='$getmessage', members='$getmembers' WHERE ClubID='$clubno'";

            if(mysql_query($sqlqup))
    {
            echo " Club page updated ";
        echo '<hr>';
        echo 'head:';
    echo $gethead;
    echo '<hr>';
    echo 'Teacher:';
    echo $getteacher;
    echo '<hr>';
    echo 'News:';
    echo $getnews;
    echo '<hr>';
    echo 'Message:';
    echo $getmessage;
    echo '<hr>';
    echo 'Members';
    echo $getmembers;
    echo '<hr>';
    }
      else
            {
        echo " Failed to upadate, Reason for failing<br />\n" . mysql_error();
    }

    }
    else
        {
            echo "<div align='center'>". $error ."</div>";
    }
    }
    else
    {
        $sqlview="select * from `intranet`.`club_data` WHERE ClubID='$clubno'";

        $mclubqu = mysql_query($sqlview);
       
    $club = mysql_fetch_array($mclubqu);
    ?>
      <div align="center">
        <h1><? echo $club['Club']?> Club</h1>
          <form action="" method="POST">
      <table width="588"  border="1.2">
        <tr>
          <td width="95">Head</td>
      <td width="7">&nbsp;</td>
            <td width="302"><input name="head" type="text"/></td>
      <td width="166"><? echo $club['Head']?> </td>
        </tr>
            <tr>
          <td>Teacher</td>
      <td>&nbsp;</td>
          <td><input name="teacher" type="text"/></td>
      <td><? echo $club['Teacher']?> </td>
        </tr>
        <tr>
          <td>News</td>
      <td>&nbsp;</td>
          <td><textarea name="news" cols="40" rows="10"></textarea></td>
      <td><? echo $club['News']?> </td>
        </tr>
      <tr>
          <td>Message</td>
      <td>&nbsp;</td>
          <td><textarea name="message" cols="40" rows="10"></textarea></td>
      <td><? echo $club['Message']?> </td>
        </tr>
      <tr>
          <td>Members</td>
      <td>&nbsp;</td>
            <td><textarea name="members" cols="40" rows="10"></textarea></td>
      <td><? echo $club['members']?> </td>
        </tr>
      </tr>
      <tr>
          <td>&nbsp;</td>
      <td>&nbsp;</td>
          <td><center><input type="submit" name="Submit_1" value="Submit" /> </center>
    </td>
        <td>&nbsp;</td>
      </tr>
      </table>
    </form>
        </div>

    <?php
    }
    ?>[/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.