
maxudaskin
Members-
Posts
628 -
Joined
-
Last visited
Everything posted by maxudaskin
-
Are you asking how to do it? There are two ways that I know: <?php /* Way One */ mysql_query("SELECT * FROM table WHERE this = 'this' OR that = 'that'"); /* Way Two */ mysql_query("SELECT * FROM table WHERE this = 'this' || that = 'that'"); ?>
-
Is it possible to use SUM() and WHERE in the same query if they are both using the same column? <?php $query = mysql_query("SELECT type, pid, SUM(totaltime) as sumValue FROM pireps GROUP BY `pid` WHERE type = '0' AND `pid` = '$poster_pid'"); $hours = mysql_fetch_array($query) or die ("MySQL Error on line 472: " . mysql_error()); // Line 472 ?> Outputs Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.grable/vzoom/virtualzoom.net/comm/forum.php on line 473 MySQL Error on line 472: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE type = '0' AND `pid` = '0100'' at line 1
-
Thanks... I thought I knew almost everything about PHP... I guess that I will have to do a bit more research.
-
I made a posting page that gets text from a Text Area but when I call the variable for the text, I end up loosing all of the new lines made with the enter key. Is there a way around this? The variable keeps the new line, but when echoing it, it ignores the new line. For Example: <?php $text = "Hello This is two lines down!"; ?> Would echo Hello This is two lines down!
-
Always an error when it comes to email addresses...
maxudaskin replied to maxudaskin's topic in PHP Coding Help
Thank you. -
Always an error when it comes to email addresses...
maxudaskin replied to maxudaskin's topic in PHP Coding Help
The error is with Inserting... Two reasons how I know, only one Insert, two, the INSERT INTO is the only one with the email, datetime, and ip... -
Basically, I made a script in 30 minutes, corrected the syntax errors in about 2, but now I am stuck on the MySQL error I got... <?php function subscribe (){ if($_GET['do'] == "unsubscribe"){ if(!empty($_GET['id'])){ $email = $_GET['email']; $query = mysql_query("SELECT * FROM dnh_subscribers WHERE email = '$email'") or die("MySQL Error: " . mysql_error()); if(mysql_num_rows($query) != 0){ mysql_query("DELETE FROM dnh_subscribers WHERE email = '$email'") or die("MySQL Error: " . mysql_error()); echo "Your email, " . $email . ",has been removed from the list."; }else{ echo "I am sorry, I cannot remove you from the subscriber list because either you have specified the wrong email or your email has already been removed."; } }else{ echo "We cannot unsubscribe you as you have not supplied an email."; } }else{ if(!empty($_POST['email'])){ $email = $_POST['email']; if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ echo "ERROR: You did not input a correct email. The email must be formatted like this: [email protected]"; }else{ $query = mysql_query("SELECT * FROM dnh_subscribers WHERE email = '$email'"); if(mysql_num_rows($query) == 0){ $datetime = gmdate("Y/m/d H:i:s"); $ip = $_SERVER['REMOTE_ADDR']; mysql_query("INSERT INTO dnh_subscribers ('email','datetime','ip') VALUES ('$email','$datetime','$ip')") or die("MySQL Error: " . mysql_error()); // Error Here echo "Thank you for subscribing. When another person is added to the DNH list, you will automatically be notified."; }else{ $result = mysql_fetch_array($query); echo "Your email is already on the list, would you like to unsubscribe? "; echo "<a href=\"index.php?do=unsubscribe&email=" . $result['email'] . "\">Yes</a> <a href=\"index.php\">No</a>"; } } }else{ echo "<form action=\"" . $PHP_SELF . "\" method=\"post\">"; echo "<label>"; echo "<input name=\"email\" type=\"text\" id=\"email\">"; echo "</label>"; echo "<label>"; echo "<input type=\"submit\" name=\"Submit\" value=\"Subscribe to Updates\">"; echo "</label>"; echo "<span class=\"style1\">Your email will never be given to 3rd parties.</span>"; echo "</form>"; } } } ?> This function is called on another page (irrelevant). Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''email','datetime','ip') VALUES ('[email protected]','2008/03/26 20:54:07','' at line 1
-
Nvm, I will just rewrite, I want to sell the script, not hand it out for free. Thanks anyways.
-
Please PM me for the script as I do not want to give it away to and everyone. Something going wrong with returning values and sessions. Your help is appreciated.
-
I don't have it set up for a server.
-
It is my first time using constants, I usually use variables, so I want to know if the following is correct. <?php /* PIREP SYSTEM - WRITTEN BY MAX UDASKIN - BASIC SYSTEM */ /* CONSTANTS.PHP */ /* Database */ define("DBSERVER","localhost"); // Database Server define("DBNAME","database"); // Database Name define("DBUSER","username"); // Database User define("DBPASS","password"); // Database Password /* Generic */ define("ROOT","http://www.someurl.com"); // Root URL ?> <?php /* PIREP SYSTEM - WRITTEN BY MAX UDASKIN - BASIC SYSTEM */ /* FUNCTIONS.PHP */ function initializePage (){ session_start(); include("constants.php"); include("login.php"); } function database($do){ if($do == "con"){ $con = mysql_connect(DBSERVER,DBUSER,DBPASS) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db(DBNAME,$conn); }elseif($do == "dis"){ mysql_close($con); } } ?> If I was to call initializePage then database(con), would it work? Would it connect or give an error?
-
Now I get: Cannot Continue; Email not stored. MySQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
-
or just put the all in with AND between them
-
This script: <?php if(!$logged_in){ exit("ERROR: You have specified an illegal operation; You are not logged in."); }else{ if(!$_SESSION['type'] == 1){ exit("ERROR: You have specified an illegal operation; You are not an Administrator."); }else{ $pid = $_GET['pid']; $udate = date("Y-m-d"); $ztime = gmdate("g:i A"); $sender = "OOM".$_SESSION['username']." ".$_SESSION['name']; $query = mysql_query("SELECT * FROM users WHERE pid = '$pid'") or die("MySQL ERROR: " . mysql_error()); $result = mysql_fetch_array($query); $name = $result['fname'] . " " . $result['lname']; $to = $result['email']; $tofull = "OOM" . $pid . " " . $name; $subject = "Virtual Zoom Airlines | TERMINATION WARNING"; $message = "Dear " . $name . ", This is a termination warning from Virtual Zoom Airlines. Your account; OOM" . $pid . " has been put on termination notice. If you do not comply with the following, your account will be suspended and your name will be put on our Do Not Rehire list. ---------- File a flight within 72 hours of this email OR email [email protected] requesting a leave of absence. ---------- The reason you have recieved this termination warning is listed below: ---------- You have not filed a flight in " . $_GET['diff'] . " days. ---------- Sent by: " . $sender . " on " . $udate . " at " . $ztime . " ZULU. ------------------------- This email was sent by an administrator of Virtual Zoom Airlines. If you feel that this email has objectable content, please forward your complaint to [email protected]."; $header = "From: $from"; mysql_query("INSERT INTO `sent_emails` (`to` ,`from` ,`subject` ,`message` ,`date`) VALUES ($to, $sender, $subject, $message, $udate") or die("Cannot Continue; Email not stored. MySQL ERROR: " . mysql_error()); } } ?> Inputs: $to = [email protected] Outputs: Cannot Continue; Email not stored. MySQL ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@hotmail.com, OOM0100 Max Udaskin, Virtual Zoom Airlines | TERMINATION WARNING, ' at line 1 Table Information: Does anyone see an issue?
-
WOW! The site could use a bit of, well, fixing up, but I am amazed at the quality of that FS9 plane... do you have an 8800 Ultra?
-
Very nice... I like the transitions (javascript I presume) when you click a menu link...
-
Too simple... keep with the box concept, but make the borders a lighter shade... and put borders around the main content too.
-
I do not like it because it is very blank in some spots and very vibrant in others... you need to stick with a concept throughout the entire page, or have a nice / interesting transition between the two. You need to be an avid and skilled designer to create a site that can have two drastically different designs merged into one and to make it look good...
-
I don't even know what to call this error...
maxudaskin replied to maxudaskin's topic in PHP Coding Help
SOLVED -
I don't even know what to call this error...
maxudaskin replied to maxudaskin's topic in PHP Coding Help
Ouch... a little harsh... here is the code... $_POST['text'] is the image thing posted in the first post. <?php /* constants */ $smilies = array("[img=","]","","","","",":/",":smile:",":sad:",":happy:","",":peace:",":argue:",":rockband:",":hithead:",":hitheadexplode:",":beer:",":pop:",":box:",":boxing:",":dissolve:",":chairtohead:",":clap:",":needle:",":cheers:",":snackbowl:",":fishslap:",":toughguy:",":laugh:",":friends:",":coke:",":knight:",":cellphone:",":pepsi:",":prankcall:",":picture:",":moreandmore:",":poke:",":mad:",":rage:",":cyborg:",":lostwings:",":pacing:",":singtodevil:",":bound:",":smoke:",":no:",":censored:"); $locations = array('<img src=\"','\" />',"<img src='../comm/smilies/smile.gif' />","<img src='../comm/smilies/sad.gif' />","<img src='../comm/smilies/biggrin.gif' />","<img src='../comm/smilies/tongue.gif' />","<img src='../comm/smilies/unsure.gif' />","<img src='../comm/smilies/smile.gif' />","<img src='../comm/smilies/sad.gif' />","<img src='../comm/smilies/biggrin.gif' />","<img src='../comm/smilies/confused.gif' />","<img src='../comm/smilies/signs/peace.gif' />","<img src='../comm/smilies/3.gif' />","<img src='../comm/smilies/5.gif' />","<img src='../comm/smilies/6.gif' />","<img src='../comm/smilies/7.gif' />","<img src='../comm/smilies/8.gif' />","<img src='../comm/smilies/9.gif' />","<img src='../comm/smilies/10.gif' />","<img src='../comm/smilies/11.gif' />","<img src='../comm/smilies/12.gif' />","<img src='../comm/smilies/13.gif' />","<img src='../comm/smilies/14.gif' />","<img src='../comm/smilies/16.gif' />","<img src='../comm/smilies/17.gif' />","<img src='../comm/smilies/18.gif' />","<img src='../comm/smilies/19.gif' />","<img src='../comm/smilies/20.gif' />","<img src='../comm/smilies/21.gif' />","<img src='../comm/smilies/22.gif' />","<img src='../comm/smilies/23.gif' />","<img src='../comm/smilies/24.gif' />","<img src='../comm/smilies/25.gif' />","<img src='../comm/smilies/26.gif' />","<img src='../comm/smilies/27.gif' />","<img src='../comm/smilies/28.gif' />","<img src='../comm/smilies/29.gif' />","<img src='../comm/smilies/30.gif' />","<img src='../comm/smilies/31.gif' />","<img src='../comm/smilies/32.gif' />","<img src='../comm/smilies/34.gif' />","<img src='../comm/smilies/35.gif' />","<img src='../comm/smilies/36.gif' />","<img src='../comm/smilies/37.gif' />","<img src='../comm/smilies/38.gif' />","<img src='../comm/smilies/39.gif' />","<img src='../comm/smilies/no.gif' />","<img src='../comm/smilies/censored.gif' />"); /* Code */ if(!empty($_GET['p'])){ if($_GET['p'] == "post"){ if($_POST['submit'] == "Preview"){ $subject = $_POST['subject']; $text = $_POST['message']; $type = $_POST['type']; echo "<table style=\"border-top:1px #FFFFFF solid\" width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; echo "<tr><td height=\"20\" colspan=\"2\" bgcolor=\"#333355\"><span class=\"style26\"> ".$subject."</span></td></tr><tr>"; echo "<td width=\"17%\" rowspan=\"3\" valign=\"top\" nowrap=\"nowrap\" bgcolor=\"#EFF4FB\" style=\"border-bottom:1px #333355 solid; border-right: 1px #333355 solid; padding-left:5px;\"><br />OOM".$pid."<br />".$name."<br /><br />".$hours." Hours<br />".$rank."<br />".$position."<br /><br /><br /></td>"; echo "<td width=\"83%\" height=\"15\" valign=\"top\" bgcolor=\"#F6F6F6\" style=\"padding-left:5px\">"; echo "<em>Posted on ".$date." at ".$time."</em></td></tr>"; echo "<tr><td valign=\"top\" style=\"padding-left:5px; padding-top:3px;\" bgcolor=\"#FFFFFF\"> ".str_replace($smilies,$locations,$text)."</td></tr><tr><td height=\"39\" bgcolor=\"#FFFFFF\" style=\"border-bottom:1px #333355 solid; padding-left:5px;\">Signature </td></tr></table>"; } -
I don't even know what to call this error...
maxudaskin replied to maxudaskin's topic in PHP Coding Help
it is removing the http:/ and leaving one of the forward slashes... (http://) -
I don't even know what to call this error...
maxudaskin replied to maxudaskin's topic in PHP Coding Help
what'd you do? -
I have a script that will change [img ]http:// to <img src=' and [/ img] to ' /> but whenever I use it, it shows this: and the insert text is: http://www.virtualzoom.net/images/TOPLOGO.gif[/ img]