-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
um yeah it will display fine...
-
I suggest you use notepad++ or another editor. you can see the syntax errors in the php tags.
-
hmm, are you sure those are the correct names of the columns? also, you can get an associative array like this mysql_fetch_assoc() instead of passing in the second parameter. it makes no difference, but just so you know. but printf prints a formatted string, the second paramters (and paramters after words) are arguments that are put into the formatted string. try just doing print_r($row);
-
yes it is. once PHP comes upon an error, it stops and tells you the error. code tags are just that. tags to put code in. you can use [ code ] [/ code ] for general code, or [ php ] [/ php ] for php tags (without the spaces of course) the line you specified, echo "<img src="$purl[$c]">"; when you have double quotes surrounding a string, you have to either escape double quotes that are inside the strings, or use single quotes, like so echo "<img src=\"$purl[$c]\">";//escape quotes echo "<img src='$purl[$c]'>";//single quotes
-
this $row['id'], $row['level']); makes absolutely no sense. What are you trying to do with this line
-
If you want someone to write code for you, i suggest you go to the freelance forum. This forum is for help with a script you are trying to write. but if you refuse to try, you won't get any help
-
firstly, post your code in code tags. also you dont need to post html or javascript if you have a php problem. but the first thing that caught my eye $myfile="Catalog.txt"; //$myfile is now catalog.txt $fp= fopen($Catalog,'r'); $Catalog doesn't exist. perhaps you meant $myfile="Catalog.txt"; $fp= fopen($myfile,'r'); the following $myfile="Catalog.txt"; //$myfile is now catalog.txt $fp= fopen($Catalog,'r'); //fh is file handle $readfile=""; //reads & stores the entire catalog in $readfile while(!feof($fp)) { $readfile.=fgets($fp,1024); $readfile=str_replace("\r","",$Catalog); }; should probably be something like $myfile="Catalog.txt"; //$myfile is now catalog.txt $fp= fopen($myfile,'r'); //fh is file handle $readfile=""; //reads & stores the entire catalog in $readfile while(!feof($fp)) { $readfile.=fgets($fp,1024); $readfile=str_replace("\r","",$readfile); } also you don't need a semi colon after closing brackets like you have in your while loop another thing, this doesn't make sense while ($Catalog!=""){ $delimiter=strpos($Catalog,0,1); $Catalog=substr($catalog,2); $c=0;//you should create this loop variable outside the loop. //every time the loop gets run, it gets overwritten. $endofrow=strpos($Catalog,"$"); $row=substr($Catalog,0,$endofrow); $Catalog=substr($Catalog,$endofrow+1); $c++; //are you sure you want to update your loop variable here? //usually you update loop variables at the end of the loop $temp=strpos($row,$delimiter); $pN[$c]=substr($row,0,$temp); $row=substr($row,$temp+1); $temp=strpos($row,$delimiter); $pC[$c]=substr($row,0,$temp); $row=substr($row,$temp+1); $purl[$c]+$row; };//you dont need that semi colon, as I stated above $Catalog isn't defined. What kind of errors are you getting? you must be getting quite a few syntax and logical errors maybe it should look something like this $c=0; while ($Catalog!=""){ $delimiter=strpos($Catalog,0,1); $Catalog=substr($catalog,2); $endofrow=strpos($Catalog,"$"); $row=substr($Catalog,0,$endofrow); $Catalog=substr($Catalog,$endofrow+1); $temp=strpos($row,$delimiter); $pN[$c]=substr($row,0,$temp); $row=substr($row,$temp+1); $temp=strpos($row,$delimiter); $pC[$c]=substr($row,0,$temp); $row=substr($row,$temp+1); $purl[$c]+$row; $c++; } but to be completely honest, I still have no clue what this is supposed to accomplish, and whatever it is, it doesn't appear as if it would be. Can you describe the errors your getting?
-
oh haha. you never do the $row = mysql_fetch_array($sql) part
-
the i being a 1 doesn't make any sense either. if thats what your teacher wrote on the board, then you have a terrible teacher. a for loop looks like the following usually for ($i = 0; $i < Number of times; $i++){ but i guess you could also do for ($i = 1; $i <= number of times; $i++){ if you want your loop to run 3 times, then it should be something like for ($i = 0; $i < 3; $i++); but to be completely honest, none of that really makes sense at all. $pN and $pC seem like arrays, but you access $pN like its a variable. can you post the rest of your code? and perhaps a description of what you want it to do
-
um, i dont know what $i should be, but its because in this line for ($c=1;i<=$c,$c++){ i should be $i. but what is $i? This loop doesn't even really make any sense at all. How many times do you want this loop to run
-
i said $row... not $_SESSION...
-
if everything but post_count is showing up, than it would seem that either the column isn't called post_count (which you confirmed it did) or the column doesn't have any data stored at that place. check your database, and make sure it looks at is should
-
do a vardump or $row['level'] and $row['id'] it seems those variables aren't being populated with data from your data base
-
Make a website? add functionality, and when you don't know how to do it, learn.
-
well keldorn provided the standard email validation function. you can check the length of strings via the strlen(), and if the lengths are too long, then tell the user whatever is too long. for example if (strlen($comment) > 500){ echo "Comment too long!"; exit(); } that would limit the length of the comment to no more than 500 characters. you could do the same for the others. to protect against getting spammed, you could create a session for a user, and if they submitted the form, set the session to true, or something. then check the session before you send the email
-
you forgot the closing bracket here if($count==1){ // register $_SESSION session_start(); $_SESSION['username'] = $username; $_SESSION['pass'] = $pass; $_SESSION['id'] = $row['id']; $_SESSION['level'] = $row['level']; else { echo "Incorrect Username or Password"; exit ; } should be if($count==1){ // register $_SESSION session_start(); $_SESSION['username'] = $username; $_SESSION['pass'] = $pass; $_SESSION['id'] = $row['id']; $_SESSION['level'] = $row['level']; } else { echo "Incorrect Username or Password"; exit ; } also you should put session_start() at the top of the page
-
you dont really need to worry about html tags unless you are sending an HTML email. seem to be sending a plain text email, so any html will come up as plain text. However, besides that keldorn is correct, you should think about some validation
-
SELECT * selects everything. so you don't have to (and can't apparently) specify another column to grab, since its already grabbing that column $sql="SELECT *, id, level etc...."; just change that to $sql="SELECT * FROM $tablename ... etc";
-
you can do that with CSS
-
this if ( $entry = -1 ) $entry = $count; should be if ( $entry == -1 ) $entry = $count; besides that i dont see a problem
-
well mysql_real_escape_string is made specifically to protect sql queries against sql injections. are you sure that it was a SQL injection? How were you using mysql_real_escape_string()?
-
mysql_real_escape_string() is commonly used for protecting against sql injections
-
[SOLVED] Weird MySQL error, why am I recieving this?
mikesta707 replied to MySQL_Narb's topic in PHP Coding Help
if you did what i said to do correctly, then it wouldn't have thrown an error. There are an infinite amount of ways for you to do it wrong, so how am I going no which way you did it wrong. Being smart has nothing to do with knowing how you failed to follow my advice or die can't go in if/while/etc statements. you should put it after the mysql query $get = mysql_query("SELECT * FROM users") or die(mysql_query()); -
[SOLVED] Weird MySQL error, why am I recieving this?
mikesta707 replied to MySQL_Narb's topic in PHP Coding Help
then you didnt do it right. post it. in the future, if you add some code and your code isn't fixed, just don't say its not working. post the updated code -
??? post the code you use to write the data to the file.... you just posted the template file