-
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
-
Re: Need some help
You'll have to be a bit more specific.
What is your exact question?
-
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);
}
?>
-
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);
}
?>