i wish to create the following form:
<html>
<body>
<form action="phpscript.php" method="post">
<input type="button" value="get data">
</form>
</body>
</html>
then connect it to the following php/mysql select statement:
$query = "select firstName- lastName from myTable";
- how can i go by doing that? that is- when i press the "get data" button that query is executed.
thanks so much.
Seco thank you very much for helping me. the results would appear in a table- right? now do we not need a $_POST[ ] kind of thing to link to the submit button?
hi seco- please ignore the above. i have just tested it and worked fine- YOU ARE THE MAN. there is only one little thing: the records are not lined up: for example- the second row is also on the first row. any solution?? thanks so much.
I have a DB working where imgs are stored in the DB and do not want that but can t get it to work with pulling the filename. Are in 2 different files..
<?php
header("Content-type: image/jpeg");
$prodid = $_GET[ id ];
$con = mysql_connect("localhost"- "test"- "test") or die( );
mysql_select_db("store"- $con);
$query = "SELECT image from products WHERE prodid = $prodid";
$result = mysql_query($query);
$row = mysql_fetch_array($result- MYSQL_ASSOC);
$picture = $row[ prodid ];
echo $picture;
?>
while($row=mysql_fetch_array($result- MYSQL_ASSOC))
{
$prodid = $row[ prodid ];
$description = $row[ description ];
$image = $row[ pic ];
echo "<tr><td>$prodid</td><td>$description</td>\n";
echo "<td><img src=\"showimage.php?id=$prodid\" width=\"80\" height=\"60\"></td></tr>\n";
echo "<td><img src=\"images/ $pic \" width=\"80\" height=\"60\"></td></tr>\n";
}
1st img tag works w/old way
Removed and still not working- any other thoughts?
I have a 80 gb external hard drive plugged into a laptop as a server with Windows Xp. I also have FTP- MySQL- and Apache running on it.
My external hard drive is plugged in using MadDog.
The Laptop is on the network. But- sometimes- it takes time for information to load. Is there any programs that can send out the data faster to the clients? How can I improve the speed of the external hard drive?
whenever I run this statement dynamically from my website:
mysql_query("UPDATE default SET path = $path WHERE id = $id") or die(mysql_error());
It returns the 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 default WHERE id = 15 at line 1
$path is defined in a previous statement and is used multiple times in the page- so I know the variable is set. The mysql connection is not closed at this point- so I know it s not that either.
I am at my wits end here. Can someone please help me out with any suggestions?
i am hosting both php and mssql localy so i am able to change settings if need be
(the resason im using ms sql instead of mysql is the databse i need to use is used for other programs and i need to pull info that the other programs create )
As per suggestions from yahoo answers users I used header function to solve my problem- but on execution it shows warnings and the target page does nt open
Look at the entire code which I tried
<?php
if (!$_POST[ login ])
{
?>
<table cellspacing="5" cellpadding="5">
<form action="<?php echo $_SERVER[ PHP_SELF ]; ?>" method="post">
<tr>
<td valign="top"><b><font size="-3">Username</font></b></td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td valign="top"><b><font size="-3">Password</font></b></td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" name="login" value="login"></td>
</tr>
</form>
</table>
<?php
}
else
{
$uid=$_POST[ uid ];
$username=$_POST[ username ];
$password=$_POST[ password ];
$conn=mysql_connect( localhost - - ) or die (mysql_error());
$db=news;
mysql_select_db($db) or die (mysql_error());
continued
-continued
$result=mysql_query("select username from useraccounts where username= $username and password= $password ")
or die(mysql_error());
if(mysql_num_rows($result)==0)
{
header("Location:demo1.php");
}
else
{
63 session_start();
$result=mysql_query($sql);
65 $row=mysql_fetch_array($result);
$_SESSION[ uid ]=$_POST[ uid ];
68 header("Location: demo.php");
}
}
?>
But on running --
Warning: Cannot send session cookie - headers already sent by (output started at c:\apache\htdocs\project\demo1.php:12) in c:\apache\htdocs\project\demo1.php on line 63
Warning: Cannot send session cache limiter - headers already sent (output started at c:\apache\htdocs\project\demo1.php:12) in c:\apache\htdocs\project\demo1.php on line 63
Warning: Supplied argument is not a valid MySQL result resource in c:\apache\htdocs\project\demo1.php on line 65
Warning: Cannot add header information - headers already sent by (output started at c:\apache\.
plz help.
No comments:
Post a Comment