<?php
$id=$_REQUEST[ id ];
$conn=mysql_connect("localhost"-"root"-"");
mysql_select_db("neelima"-$conn);
if(isset($_POST[ add ]))
{
$name=$_REQUEST[ name ];
$id=$_REQUEST[ hid_id ];
$age=$_REQUEST[ age ];
$place=$_REQUEST[ place ];
$graduation=$_REQUEST[ graduation ];
$percentage=$_REQUEST[ percentage ];
$result=mysql_query("SELECT * FROM `db_address` WHERE name= $name ");
$num_of_rows = mysql_num_rows($result);
if($num_of_rows==0)
{
echo "allow to insert";
}
else
{
echo "show alert message like already username exists";
}
$query="INSERT INTO `db_address`(name-age-place-graduation-percentage) VALUES( $name - $age - $place - $graduation - $percentage )";
mysql_query($query);
header("location:address1.php?id=$id");
}
?>
<table border="2" bgcolor="#FFFFCC" align="center">
<input type="text" name="hid_id" value="<? echo $id;?>">
<tr><td>name</td><td><input type="text" name="name" value="<? echo $name;?> "></td></tr>
<tr><td>age</td>
mkdir($pname); or mkdir(localhost- pname);? or neither lol.
im very stuck it wont copy a file even i know it has access to do so mysql and php connect to database and write to it fine.
any and all help with this would be great
mkdir(d:/xampp/htdocs/pname);?
mkdir(localhost/xampp/htdocs/pname);?
<html>
<body>
<form method="get" action="search.php">
search for: <input type="text" name="search">
<input type="submit" name="submit" value="search">
</form>
<?php
if ($submit) {
echo "searching for: <b>$search</b><br />";
mysql_connect("mysql"- "username"- "password");
mysql_select_db("myDatabase");
$query="select * from myTable where firstName like %$search% ";
$result=mysql_query($query);
while ($row = mysql_fetch_object($result)) {
echo "Found: $row->firstName --$row->lastName<br />";
}
}
?>
</body>
</html>
- got it from a book but does not work. Should i sue the publishing company??:-)
this is a search engine for my database.
guys thanks very much. I have just tested Edison s code and it works. There- however- is a problem: it prints all the rows- like:
Found: 1st firstName value --1st lastName valueFound: 2nd firstName value --12nd lastName value
all in one row.
it was supposed to print only when it finds a match.
requinx- could you be kind enough to tell me the code as a whole? i am a beginner :-))) thanks
ok error: the 12 above is 2nd. the code prints the whole database not just the match.
Hi Edison-
Thanks a lot man- i submitted the code below but didnt work. Seems like a case of bad luck. Let s sleep on it for a while and see what happens :-)
thanks a lot- you ve been great help anyway- thanks for time.
$submit = $_GET[ search ];
if ($submit) {
echo "searching for: <b>$search</b>";
mysql_connect("mysql"- "username"- "password");
mysql_select_db("myDatabase");
$result = mysql_query("select * from myTable where firstName like \"%$search%\"
order by firstName");
echo "Found:<br>";
while ($row = mysql_fetch_array($result)) {
echo $row[ firstName ] ;
echo "--";
echo $row[ lastName ];
echo "<br>";
}
i try to go to frugooscape.net wen it says somethin about mySQL
im supposed to flush /var/www/frugooscape/index.php on line 9 with mysqladmin flush-hosts
how do i do that
thank you
Hello friends- I need Help. I have Installed Apache its working fine..but I dont know how to install PHP and MySQL. and How to write Script in...please help me to get this answer...
thanks in advace..
Cheers-
Neel
I have little knowledge. but to test it i need to install php and SQL. I m planning to develop dymamic quote web page..
please suggest best way to go
No comments:
Post a Comment