|
-
Jul 1st, 2007, 08:48 AM
#1
Thread Starter
Addicted Member
Need some help
I want to make something like this
http://domain.com/downloads.php?id=p...&serial=123456
in one php page
PHP Code:
<?php
if ($id === 'productname'){
$link = mysql_pconnect("localhost", "root", "password");
mysql_select_db("dbname") or die("Database Error.");
$query ="SELECT name, email, serial FROM info WHERE serial = '" . $_GET["serial"]. "'";
$result = mysql_query($query) or die ("Database Error." . mysql_error( ));
if ( mysql_num_rows($result) == 0 ) {
echo "Not Found Serial Match";
or die(mysql_error());
mysql_close($link);
exit;
}
while ($row = mysql_fetch_row($result)) {
echo "Found Serial";
}
mysql_free_result($result);
mysql_close($link);
}
?>
Thank you for your help
-
Jul 1st, 2007, 08:51 AM
#2
Re: Need some help
You'll have to be a bit more specific.
What is your exact question?
-
Jul 1st, 2007, 09:09 AM
#3
Thread Starter
Addicted Member
Re: Need some help
OK! sorry
i'm trying to make a page call: downloads.php
when pople insert serial number in the textbox and click on download with link
123456 is the serial number poeple insert in textbox and softwarename is kind of software they try to download.
if softwarename match and search for database serial match then download.
PHP Code:
Link should look kinda like this: http://domain.com/downlaods.php?id=softwarename&serial=123456
<?php
$id = $_GET['id'];
//here is the match downloads.php?id=softwarename
if ($id === 'softwarename'){
$link = mysql_pconnect("localhost", "root", "password");
mysql_select_db("dbname") or die("Database Error.");
$query ="SELECT name, email, serial FROM info WHERE serial = '" . $_GET["serial"]. "'";
$result = mysql_query($query) or die ("Database Error." . mysql_error( ));
if ( mysql_num_rows($result) == 0 ) {
echo "Not Found Serial Match";
or die(mysql_error());
mysql_close($link);
exit;
}
while ($row = mysql_fetch_row($result)) {
//serial=123456 match but didn't work
echo "Found Serial";
}
mysql_free_result($result);
mysql_close($link);
}
?>
Last edited by lmf; Jul 1st, 2007 at 10:20 AM.
-
Jul 1st, 2007, 12:49 PM
#4
Re: Need some help
to tell you the truth, i dont know what your code is doing... Are you trying to make it so that the file will download off your server?
try this:
PHP Code:
<?php
$id = $_GET['id'];
//here is the match downloads.php?id=softwarename
if ($id === 'softwarename'){
$link = mysql_pconnect("localhost", "root", "password");
mysql_select_db("dbname") or die("Database Error.");
$query ="SELECT name, email, serial FROM info WHERE serial = '" . $_GET["serial"]. "'";
$result = mysql_query($query) or die ("Database Error." . mysql_error( ));
if ( mysql_num_rows($result) == 0 ) {
echo "Not Found Serial Match";
or die(mysql_error());
mysql_close($link);
exit;
} else {
while ($row = mysql_fetch_row($result)) {
//serial=123456 match but didn't work
echo "Found Serial!";
}
}
mysql_free_result($result);
mysql_close($link);
}
?>
My usual boring signature: Something
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|