Masna
-
Posts
288 -
Joined
-
Last visited
Posts posted by Masna
-
-
Why are you putting everything in a loop? All of your header declarations should be outside of the loop. The only thing in the loop should be the readfile for each file (and whatever else you need to add each file to the .zip).
-
-
<input name="topic1" type="checkbox" id="topic1"<?PHP echo (!empty($_POST['topic1']))?" checked=\"checked\"":NULL; ?>>
-
var_dump(get_defined_vars());
-
Can someone show me what the error in this is.
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource n /public_html/venues/venues.php on line 23 This is line 23 $num=mysql_numrows($result);
NO Vemues Schedule
$query = 'DELETE FROM Venues WHERE DATE_SUB(CURDATE(),INTERVAL 1 DAY) >= `Date1`'; mysql_query($query); $query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8. venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100'; $result=mysql_query($query); $num=mysql_numrows($result); if ($num==0) { echo "<b>NO Vemues Schedule</b><br>"; }else{ echo "<b>Where We Are</b><br>"; } mysql_close(); $i=0; while ($i < $num) { $venues_field_1=mysql_result($result,$i,"venues_field_1"); $venues_field_2=mysql_result($result,$i,"venues_field_2"); $venues_field_3=mysql_result($result,$i,"venues_field_3"); $venues_field_4=mysql_result($result,$i,"venues_field_4"); $venues_field_5=mysql_result($result,$i,"venues_field_5"); $venues_field_6=mysql_result($result,$i,"venues_field_6"); $venues_field_7=mysql_result($result,$i,"venues_field_7"); $venues_field_8=mysql_result($result,$i,"venues_field_8"); $venues_field_9=mysql_result($result,$i,"venues_field_9"); $venues_field_10=mysql_result($result,$i,"venues_field_10"); $venues_field_11=mysql_result($result,$i,"venues_field_11"); $venues_field_12=mysql_result($result,$i,"venues_field_12"); $venues_field_13=mysql_result($result,$i,"venues_field_13"); $venues_field_14=mysql_result($result,$i,"venues_field_14"); $venues_field_15=mysql_result($result,$i,"venues_field_15"); echo "<b>$venues_field_1<br>$venues_field_2 - $venues_field_3</b><br>$venues_field_4<br>$venues_field_5<br>$venues_field_6<br>$venues_field_7<br>$venues_field_8<br>$venues_field_9<br>$venues_field_10<br>$venues_field_11<br>$venues_field_12<br>$venues_field_13<br>$venues_field_14<br>$venues_field_15<br>"; $i++; }
You have a very basic (and relatively obvious) syntax error in your query: a period where a comma should be. Use this:
$query= 'SELECT venues_field_1, venues_field_2, venues_field_3, venues_field_4, venues_field_5, venues_field_6, venues_field_7, venues_field_8, venues_field_9, venues_field_10, venues_field_11, venues_field_12, venues_field_13, venues_field_14, venues_field_15 FROM Venues ORDER BY venues_field_1 DESC LIMIT 0, 100';
Also, the function is mysql_num_rows(), not mysql_numrows (although, apparently the latter works also).
-
-
<?php // Our name $name = "john Doe"; // Seperate the name at the space, this will // give us an array with 2 values $parts = explode($name); // ucfirst makes the first character uppercase echo ucfirst($parts[0]); ?>
Should be:
<?php // Our name $name = "john Doe"; // Seperate the name at the space, this will // give us an array with 2 values $parts = explode(" ", $name); // ucfirst makes the first character uppercase echo ucfirst($parts[0]); ?>
-
Place ob_start() at the top of your script.
Scratch that -- you need to place the headers at the very, very top of your script.
-
Escape it
thanks but how should i escape it?
mysql_escape_string()
-
mysql_query("INSERT INTO crashReport (application, appVersion, osVersion, comments, time, date, mailaddress, rapport) VALUES ('".$_POST['application']."', '".$_POST['appVersion']."', '".$_POST['osVersion']."', '".$_POST['comments']."', '".$_POST['time']."', '".$_POST['date']."', '".$_POST['mailaddress']."', '".$_POST['rapport']."')");
-
I am probably boring you with all these questions but what do I need to do if I want to have 4 extensions: jpeg, jpg, png, gif?
-
function store_errors($error_level, $error_message, $error_file, $error_line, $error_context){ $insert = mysql_query("INSERT INTO `table` (`error_level`, `error_message`, `error_file`, `error_line`, `error_context`) VALUES ('$error_level', '".mysql_escape_string($error_message)."', '".mysql_escape_string($error_file)."', '".mysql_escape_string($error_line)."', '".mysql_escape_string($error_context)."')"); } set_error_handler("store_errors"); //this of course implies that you've created a MySQL table called "table" with 5 fields (error_level, error_message, error_file, error_line, error_context)
-
A foreach loop is a loop that takes an array and cycles through it. $_FILES['file']['name'] is not an array: it's a string.
Try this:
foreach($_FILES as $str) { $fp = fopen('upload.xml', 'a+'); fwrite($fp, $str['name']); fclose($fp); }
-
<?php $redir = @$_GET['redir']; if (!$redir) $redir = "index.php"; if (!$userInfo['loggedin']) { $do = @$_GET['do']; if ($do == "") { fetchTemplate("header"); fetchTemplate("login"); fetchTemplate("footer"); } else if ($do == "login") { $error = ""; $user = addslashes(htmlentities($_GET['user'])); $pass = md5(addslashes(htmlentities($_GET['pass']))); $query = mysql_query("SELECT * FROM `member` WHERE username='$user' AND password='$pass'"); $q = mysql_fetch_row($query); if (!$q[0]) { $error .= "Username and password do not match.<br />\n"; } else { $_SESSION['loggedin'] = 1; $_SESSION['user'] = $user; header("Location: ".$redir); } if ($error) { fetchTemplate("header"); echo "<br><p align=center><font color=red>".$error."</font></p>"; echo "\n<p align=center><a href=\"login.php\">[ Back ]</a></p>\n"; fetchTemplate("footer"); } } } else { header("Location: index.php"); } ?>
-
firstpage.html
<form action="secondpage.php" method="post"> <input type="text" name="username"> <input type="submit" name="submit" value="Login"> <form>
secondpage.php
$username = $_POST['username'];
-
Perhaps you could post the code that is sending these e-mails?
-
$_GET['id']
-
Yeah, it took me a bit longer than it should have to notice it, but your headers are formatted incorrectly.
-
You can convert it to a string by typecasting the variable. Although I can't see how it could be anything other than a string, when you're retrieving it from the database?
So, can you post how you retrieve $mydate?
-
Try getting ridding of the last parameter ($headers). Does it work now?
-
Can you post how you're retrieving $mydate?
-
Do you have a member system implemented in your site? If so, what kind of $_SESSION data (and with what array keys) are set when a user is logged in?
-
Add ob_start() to the top of your script. Does mail() work now?
no adding ob_start(); didnt change anything.
Underneath the call to mail(), echo $email. What is outputted?
-
You can combine this line -
if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept']))
into -
if (!isset($error['name'], $error['email'], $error['password'], $error['accept']))
What the OP posted and what you have here are, logically, not the same. Passing multiple variables to isset (joined by commas) checks them all with respect to OR; that is, if any one of the 4 variables passed in here isn't set, the entire statement will return true (because of the logical NOT; isset will return false).
$index=strpos(substr($data[0]['long_descr'],0,20),'same_as');
in PHP Coding Help
Posted
Ever heard of the manual?
http://php.net/substr