Jump to content

doforumda

Members
  • Posts

    300
  • Joined

  • Last visited

    Never

Posts posted by doforumda

  1. hi

     

    i want to make a clone that will read all the text and images from other news websites. so i want to know how can it be possible?

     

    i mean to ask how can i clone other website by using PHP?

  2. hi

    i made some changes now i am getting this error

     

    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 ''fname','lname',region,ssn) values ('zafar','saleem',2,77785555552112' at line 1

     

     

    my code is

     

    <?php
    $firstName=(isset($_POST['firstName']))?$_POST['firstName']:"";
    $lastName=(isset($_POST['lastName']))?$_POST['lastName']:"";
    $region=(isset($_POST['region']))?$_POST['region']:"";
    $ssn=(isset($_POST['ssn']))?$_POST['ssn']:"";
    
    
    $db = mysql_connect("localhost","username","password");
    mysql_select_db("db");
    //$query = "select * from statusValues";
    //$result = mysql_query($query);
    
    if(isset($function) && $function=="true")
    {
    	$sqlInsert = "insert into statusvalues2 ('fname','lname',region,ssn) 
    					   values ('".$fname."','".$lname."',".$rnumber.",".$snumber.")";
    
    //echo $sqlInsert;
    /*$sqlInsert = "insert into statusvalues set 'firstName'='".$firstName."','lastName'='".$lastName."','region'='".$region."','ssn'='".$ssn."'";*/
    	$result = mysql_query($sqlInsert) or die(mysql_error());
    
    }
    ?>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form id="form1" name="form1" method="post" action="index1.php?function=true">
      <label>First Name:
      <input type="text" name="fname" id="fname" />
      </label>
      <p>
        <label>Last Name:
        <input type="text" name="lname" id="lname" />
        </label>
      </p>
      <p>
      <?php
      		$regSQL = "select * from regions";
    	$regSQLResult = mysql_query($regSQL);
      ?>
        <label>Select Region Number:
        <select name="rnumber" id="rnumber">
        <?php while($myrow = mysql_fetch_array($regSQLResult)) { ?>
       
        <option value="<?php echo $myrow['regionNumber']; ?>"><?php echo $myrow['regionNumber']."-".$myrow['regionName']; ?></option>
        
        <?php } ?>
        </select>
        </label>
    </p>
      <p>
        <label>Enter SSN No Dashes
        <input type="text" name="snumber" id="snumber" />
        </label>
      </p>
      <p>
        <label>
        <input type="submit" name="Submit" id="Submit" value="ok" />
        </label>
      </p>
    </form>
    </body>
    </html>
    

  3. when i comment if() statement out

     

    <?php
    $firstName=(isset($_POST['firstName']))?$_POST['firstName']:"";
    $lastName=(isset($_POST['lastName']))?$_POST['lastName']:"";
    $region=(isset($_POST['region']))?$_POST['region']:"";
    $ssn=(isset($_POST['ssn']))?$_POST['ssn']:"";
    
    $db = mysql_connect("localhost","root","123456");
    mysql_select_db("cartoonsmart");
    //$query = "select * from statusValues";
    //$result = mysql_query($query);
    
    //if(isset($function) && $function=="true")
    //{
    	$sqlInsert = "insert into 'statusvalues' ('firstName','lastName','region','ssn') 
    					   values ('".$firstName."','".$lastName."','".$region."','".$ssn."')";
    	echo $sqlInsert;
    
    //$sqlInsert = "insert into statusvalues set 'firstName'='".$firstName."','lastName'='".$lastName."','region'='".$region."','ss#'='".$ssn."'";
    	$result = mysql_query($sqlInsert) or die(mysql_error());
    //}
    ?>

     

    then it displays this error

     

    insert into 'statusvalues' ('firstName','lastName','region','ssn') values ('','','','')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 ''statusvalues' ('firstName','lastName','region','ssn') values ('','',' at line 1

  4. hi again

     

    i have a code with insert query. yesterday one of the member in this forum helped in solving it and it worked but today when i am using that same technique with other code it doesnt work. the code is below

    the problem with this code is it doesnt insert data into mysql database.

     

     

    <?php
    $firstName=(isset($_POST['firstName']))?$_POST['firstName']:"";
    $lastName=(isset($_POST['lastName']))?$_POST['lastName']:"";
    $region=(isset($_POST['region']))?$_POST['region']:"";
    $ssn=(isset($_POST['ss#']))?$_POST['ss#']:"";
    
    $db = mysql_connect("localhost","username","password");
    mysql_select_db("database");
    //$query = "select * from statusValues";
    //$result = mysql_query($query);
    
    if(isset($function) && $function=="add")
    {
    $sqlInsert = "insert into statusvalues(firstName,lastName,region,ss#) values('".$firstName."','".$lastName."','".$region."','".$ssn."')";
    	$result = mysql_query($sqlInsert) or die(mysql_error());
    }
    ?>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    
    <body>
    <form id="form1" name="form1" method="post" action="index1.php?function=add">
      <label>First Name:
      <input type="text" name="firstName" id="firstName" />
      </label>
      <p>
        <label>Last Name:
        <input type="text" name="lastName" id="lastName" />
        </label>
      </p>
      <p>
      <?php
      		$regSQL = "select * from regions";
    	$regSQLResult = mysql_query($regSQL);
      ?>
        <label>Select Region Number:
        <select name="region" id="region">
        <?php while($myrow = mysql_fetch_array($regSQLResult)) { ?>
       
        <option value="<?php echo $myrow['regionNumber']; ?>"><?php echo $myrow['regionNumber']."-".$myrow['regionName']; ?></option>
        
        <?php } ?>
        </select>
        </label>
    </p>
      <p>
        <label>Enter SSN No Dashes
        <input type="text" name="ssn" id="ssn" />
        </label>
      </p>
      <p>
        <label>
        <input type="submit" name="Submit" id="Submit" value="ok" />
        </label>
      </p>
    </form>
    </body>
    </html>
    
    

  5. hi i need help in the following code

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>Untitled Document</title>

    </head>

     

    <body>

    <form name="form1" method="post" action="insert.php">

      <label>First Name:

      <input type="text" name="fname" id="fname">

      </label>

      <p>

        <label>Last Name:

        <input type="text" name="lname" id="lname">

        </label>

      </p>

      <p>

        <label>Address:

        <input type="text" name="address" id="address">

        </label>

      </p>

      <p>

        <label>Phone:

        <input type="text" name="phone" id="phone">

        </label>

      </p>

      <p>

        <label>

        <input type="submit" name="submit" id="submit" value="Submit">

        </label>

    </p>

    </form>

    </body>

    </html>

     

    above is my form

    and below is my php code

     

    <?php

    $db = mysql_connect("localhost","username","password");

    mysql_select_db("example",$db);

    $query = "insert into example(fname, lname, address, phone) values('".$fname."','".$lname."','".$address."','".$phone."')" or die(mysql_error());

    $result = mysql_query($query) or die(mysql_error());

     

    echo "data entered";

    ?>

     

    when i insert something using that form it displays following error

     

     

    Notice: Undefined variable: fname in C:\wamp\www\New Folder\insert.php on line 12

     

    Notice: Undefined variable: lname in C:\wamp\www\New Folder\insert.php on line 12

     

    Notice: Undefined variable: address in C:\wamp\www\New Folder\insert.php on line 12

     

    Notice: Undefined variable: phone in C:\wamp\www\New Folder\insert.php on line 12

    data entered

     

    how can i solve this problem

  6. Here is the code

     

    <?php

    $db_connect = mysql_connect("localhost","username","password");

    mysql_select_db("database",$db_connect);

     

    if(isset($function) && $function == "edit")

    {

    echo "Function is not set";

    $sql_query = "select * from statusvalues where statVal_id = &mode";

    print($sql_query);

    }

     

     

    if(isset($function) && $function == "add")

    {

    echo "This is the value - $regionNumber<br>";

    $sql_query = "insert into statusvalues (firstname,lastname,region,ssn) values ('".$fname."','".$lname."','".$regionNumber."','".$ssn."')";

    $exe_query = mysql_query($sql_query);

    }

     

    $sql_reg = "select * from region";

    $sqlQuery = mysql_query($sql_reg);

     

    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <script language="JavaScript">

     

    function go_to_page(hlink)

    {

    window.location = "indexxx2.php?function=edit&mode="+hLink+"";

    }

    </script>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <title>Untitled Document</title>

    </head>

     

    <body>

    <form name="form1" method="post" action="indexxx.php?function=add">

      <p>First Name:

        <input type="text" name="fname" id="fname">

    </p>

      <p>Last Name:

        <input type="text" name="lname" id="lname">

    </p>

      <p>Select Region Number:

      <?php

        echo "<select name='regionNumber' id='regionNumber'>";

        while($record = mysql_fetch_array($sqlQuery))

    {

        echo "<option value = '".$record['regionNumber']."'>".$record['regionNumber']."-".$record['regionName']."</option>";

        }

    echo "</select>";

    ?>

     

      </p>

      <p>Enter SSN No Dashes:

        <input type="text" name="ssn" id="ssn">

      </p>

      <p>

        <input type="submit" name="button" id="button" value="OK">

      </p>

    </form>

    <?php

     

    $selectQuery = "select * from statusvalues";// order by lastname ASC";

    $resultName = mysql_query($selectQuery);// or die(mysql_error());

    ?>

    <table width='400' border='1' cellspacing='0' cellpadding='0'>

      <tr>

        <td>ID</td>

        <td>First Name</td>

        <td>Last Name</td>

        <td>Region</td>

    <td> </td>

      </tr>

    <?php while($record = mysql_fetch_array($resultName)) { ?>

     

      <tr>

        <td><?php echo $record['statVal_id'] ?></td>

        <td><?php echo $record['firstname'] ?></td>

        <td><?php echo $record['lastname'] ?></td>

        <td><?php echo $record['region'] ?></td>

    <td><input type = "button" name = "edit1" value = "Edit" onclick="javascript(go_to_page(<?php echo $record['statVal_id'] ?>));"/></td>

      </tr>

    <?php } ?>

      </table>

    </body>

    </html>

     

  7. hi i want to embed javascript in php code how can i embed the javascript in the following code

     

      echo "<tr>

        <td>".$record['statVal_id']."</td>

        <td>".$record['firstname']."</td>

        <td>".$record['lastname']."</td>

        <td>".$record['region']."</td>

    <td><input type = 'button' name = 'edit1' value = 'Edit' onclick='javascript(go2Page(".$record['statVal_id']."));></td>

        </tr>";

×
×
  • 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.