![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
doforumda
-
Posts
300 -
Joined
-
Last visited
Never
Posts posted by doforumda
-
-
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?
-
anyone who can solve my problem
-
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>
-
the problem is with if statement it is not becoming true
-
well it does echoing all the variables using this way. post does work
-
my problem is still unresolved
anyone out there who can solve my problem
-
if you see the code then you will see i remove # sign
-
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
-
it is assigned in this line
<form id="form1" name="form1" method="post" action="index1.php?function=add">
-
yes i also think there is a problem with if() statment but how can i know whats the problem
-
i am not getting anything back
-
yesideez it still doesnt work
-
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>
-
ok i ll use those tags next time
can please make changes in above code
-
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
-
can you tell where am i making a mistake in my code?
-
still unresolve i am still waiting
anybody
-
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>
-
hi
i created a button "Edit" and i make a function for that in javascript. when the user click on the button it should call that javascript function and go to the specified page. i did all this but it is not doing anything.
how can this problem be solved?
-
anyone who can solve my problem
-
i created a function using javascript i am calling that function
tell me how can i use quotes etc to embed into php
-
i created a function using javascript i am calling that function
-
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>";
-
thanks spike 121 it works
Cloning in PHP
in PHP Coding Help
Posted
thank you