-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
If the field ID is a primary key or auto_increment, don't bother put it in the insert query.
$query = "INSERT INTO `members` (`username`,`user_password`) VALUES('poky1','poky');"; mysql_query($query) or die("The insert query failed because: " . mysql_error());
give that a go.
-
Password protect the folder.
His IP can change.
-
What you could do is just set up a global system that tells you where your folder points.
You can use .htaccess or a method of php to solve this.
# php $dash_switch = 1; $folder = ($dash_switch == 1) ? "himages" : "h-images"; # if 1 folder = himages ;;; no hyphens # if 0 folder = h-images ;; hyphens.
.htaccess wise
RewriteEngine On RewriteRule ^/himages/([^*]*).gif$ /h-images/$1.gif [L] # or an opposite way RewriteRule ^/h-images/([^*]*).gif$ /himages/$1.gif [L]
-
Might I also add, your query is vulnerable, try using mysql real escape string before submitting data directly from a post into your database.
-
INSERT INTO `upload2` (`name`,`size`,`type`,`path`,`title,`description`,`buy`) VALUES ('$fileName','$fileSize','$fileType','$filePath','{$_POST['title']}','{$_POST['description']}','{$_POST['buy']}');
-
$insert = "INSERT INTO $table (`field`) VALUES('$email');";
You need a column in your database table named field to have the query execute properly.
-
1. Give us an error.
2. You need to escape the links.
echo "<a href=\"link\">ENTER here</a>";
-
if(filesize($file) > 20480){ echo "File size too big!"; }else { //whatever }
-
No problem. Mark as solved.
-
You can connect to more than one database and still use them in certain queries.
$connection1 = mysql_connect("localhost","username","password"); $dbconnect1 = mysql_select_db("databasename",$connection1); $connection2 = mysql_connect("localhost","otherusername","otherpassword"); $dbconnect2 = mysql_select_db("otherdatabasename",$connection2); $query1 = mysql_query("SELECT * FROM `this` WHERE `that`='something'", $dbconnect1) or die(mysql_error()); $query2 = mysql_query("SELECT * FROM `that` WHERE `something`='this'", $dbconnect2) or die(mysql_error());
-
darkfreaks you've got a mess there.
| should be || to specify you're wanting to use the PHP Operator "OR"
= should be == to specify you're wanting to use the PHP Operator "is equal to"
$yourArray = array($name, $album, $year, $price, $stock); if(in_array($yourArray,$array) || $album == $fname || $year == $fname || $price == $fprice || $stock == $fname){ $display[] = $array; foreach($display AS $displays){ echo $displays . "<br>\n"; } }
-
<a href="/home.htm">Home</a>
The slash before home.htm tells you that you want to go back to the home directory, aka www or public_html
-
Try making session start the first line of that file.
-
`filepirate`.`FILES`
Why not just `filepirateFILES` or is it defined? If it's defined get rid of the `'s
-
use ++ not +1
++ equals +1
-
mysql_query("UPDATE `table` SET `Downloads`=`Downloads`+1 WHERE `ID`='$B'") or die(mysql_error());
-
Mark as solved.
-
Put it in quotes.
value="<?php echo $titletoedit; ?>"
-
Um, it's set as "/" by default.
Well I have:
domains.com/logout.php
and
domains.com/forums/index.php
-
The first 3 errors tell you the file does not exist, the 4th error tells you the class does not exist.
-
The file doesn't exist.
-
Yep, what Ginger said. There are three ways to produce a result from mysql fetch array, MYSQL_NUM, MYSQL_ASSOC and MYSQL_BOTH.
-
The path for the cookies are set to "/"
-
Ok. What I'm doing is checking to see whether the UID and Encrypted Password combination is correct.
if($need_log > 0){ $sql = "SELECT * FROM `users` WHERE `id`='{$_COOKIE['uid']}' AND `password`='{$_COOKIE['cpp']}'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ setcookie("uid","",time()-314496000); setcookie("cp","",time()-314496000); setcookie("cpp","",time()-314496000); unset($_COOKIE); header("Location: /index.php"); } }
It does redirect the user to the index but the cookies remain unchanged and have the same values in the end. That's the exact code I have when the user wants to log out, and that works, but the code checked here does not work.
[SOLVED] help with pagination
in PHP Coding Help
Posted
Descending order. Greatest to Least.