-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
You don't even see the HTML before you start your PHP? Your doctype declaration, etc..
-
I've been on this forum for more than 4 years and haven't even stumbled across this section ever.
Well... My name is Marcus, I'm 18 years old and live in Connecticut, USA. I enjoy doing anything a regular 18yr old enjoys doing. Partying, hanging out with friends, the norm, etc... I've been using and studying PHP/mySQL for about 5 years now. I've started off with basic HTML and CSS about 10 years ago (I know right?) Currently I'm a Junior Web Developer and Designer for a local business, that job will have to come to a rest at the end of August as I'm going off to school.
I've always been an honors student in school. Exceeding mostly in mathematics, mainly calculus and discrete mathematics. I will be attending the Rochester Institute of Technology starting August 31st. Majoring in Computer Science, may change to Computer Engineering though. I plan to achieve a Masters Degree in Computer Science (MS). Later in life I will return for a Doctorate in Education.
I'm also a YouTube Partner (share revenue with Google). I upload web development tutorials and some gadget related videos (mainly iPhone).
Cool.
-
What web hosting service are you using?
-
@dezkit
There is no need to loop through an array or a database to use a method like yours.
If this person is using an array they simply just need to use in_array or for a database use a more specific SELECT statement
$sql = "SELECT * FROM `ip_bans` WHERE `ip`='".$_SERVER['REMOTE_ADDR']."'";
-
Is it possible there are more slashes.
If name is "Johnny O\\\'neal" and you use stripslashes once you will get "Johnny O\'neal"
If you use stripslashes twice, you will get "Johnny O'neal"
-
<?php include "global.php"; // would be your file that includes functions, database connectivity, etc.. include "header.php"; // would be your file that is the chunk of HTML code that your page would start off with $page = $_GET['page']; if($page){ if(file_exists("pages/".$page.".php")){ include "pages/".$page.".php"; }else { include "pages/404.php"; } }else { include "pages/home.php"; } include "footer.php"; // would be your file that closes the open chunk of HTML from header.php ?>
Or if you don't want to use the file_exists method
<?php include "global.php"; // would be your file that includes functions, database connectivity, etc.. include "header.php"; // would be your file that is the chunk of HTML code that your page would start off with $page = $_GET['page']; $pages = array('home','about','contact'); if($page){ if(in_array($page,$pages)){ include "pages/".$page.".php"; }else { include "pages/404.php"; } }else { include "pages/home.php"; } include "footer.php"; // would be your file that closes the open chunk of HTML from header.php ?>
-
$sql = "SELECT * FROM `user_signup` WHERE `username`='".mysql_real_escape_string($_POST['username'])."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) > 0){ // taken }else { // available }
-
That's the wrong syntax for an update query.
$sql = "UPDATE `table` SET `field`='".$field1."' , `field2`='".$field2."' WHERE `this`='".$that."'";
-
You should really minimize that code
<?php $link = ($mp3 == "") ? $lang_t202 : '<a href="'.$mp3.'">'.$lang_t202.'</a>'; $F = "<div align='center'> <center> BLAH BLAH ALL YOUR OTHER HTML HERE ".$link." REST OF YOUR HTML </center></div>"; ?>
-
Between two players you should use a database and tag on some fields like game_id,letters_remaining
game_id would be relevant to another table with some fields like uid1,uid2 (for users player), status (0=not started, 1=playing, 2=finished), winner (would be uid1 or uid2)
etc..
-
You just need to set the action of the form to act with the item_id...
<form action="submit.php?id=<?php echo $variable_of_id_being_passed_in_previous_form; ?>">
-
$sql = mysql_query("SELECT * FROM `kunder` WHERE `id`='".$row['anmoder']."'") or die(mysql_error());
-
Facebook works off modrewrite for people who have a custom URL, or for people who don't have a custom URL they have a "profile.php?id=xxx"
If you wanted to have a new page "created" for each user and have it like http://site.com/USER1.php http://site.com/USER2.php you could just use modrewrite instead of actually creating the page.
-
$id = mysql_real_escape_string($_GET['id']); $query = "SELECT * FROM `".$tbl_name."` WHERE `site_id`='".$id."'"; $res = mysql_query($query) or die(mysql_error()); // then do your mysql_fetch_assoc, array, etc
-
Are you connected to a database?
$sql = "INSERT INTO `players` (`Skin`) VALUES('233')"; $res = mysql_query($sql) or die(mysql_error());
-
<?php $sql = "INSERT INTO `chars` (`accid`,`charname`,`sex`,`age`,`pgmg`,`dmrkt`,`history`,`carcrashrp`,`carscrach`) VALUES('".$_SESSION['Logged']."','".$_POST['charname']."','".$_POST['sex']."','".$_POST['age']."','".$_POST['pgmg']."','".$_POST['dmrktt']."','".$_POST['history']."','".$_POST['carcrashrp']."','".$_POST['carscrash']."')"; $res = mysql_query($sql) or die(mysql_error()); ?>
-
Where are you pulling the $row['Sex'] from? How are you comparing the IsValidSkin function to $row['Sex']?
<?php function IsValidSkin($skinid,$sex){ $valid = array(3,4,5,6,8,17,42,50,61,65,71,74,86,92,268,119,149); if(in_array($skinid,$valid)){ return true; }else { if($sex == 1){ return true; }else { return false; } } } ?>
-
Just throw that code to the top.
try this
<?php if(isset($_POST['SubmitPart2'])) { $urls = array('http://yahoo.com','http://google.com','http://ask.com','http://lycos.com','http://bing.com'); if(in_array($_POST['url'],$urls)) { header("Location: " . $_POST['url']); } else { $a = "<p>Invalid Search Engine!</p>"; } } ?> <HTML> <head> <title> Final Part 2</title> <body> <h2>Please Select a search engine.</h2> <?php echo $a; ?> <form method="POST"target="_blank"> <table> <tr> <td>Sites: </td> <td> <select name="url"> <option value="http://yahoo.com">Yahoo.com</option> <option value="http://google.com">Google.com</option> <option value="http://ask.com">Ask.com</option> <option value="http://lycos.com">Lycos.com</option> <option value="http://bing.com">Bing</option> </select> </td> </tr> <tr> <td><input type="submit" name="SubmitPart2" value="<<< Go To" /></td> </tr> </table> </form> </body>
-
<form method="post"> Choose Your Website: <select name="url"> <option value="http://google.com">Google</option> <option value="http://yahoo.com">Yahoo</option> <option value="http://bing.com">Bing</option> </select> <input type="submit" name="submit" value="Go to Search Engine"> </form> <?php if(isset($_POST['submit'])){ $urls = array('http://google.com','http://yahoo.com','http://bing.com'); if(in_array($_POST['url'],$urls)){ header("Location: " . $_POST['url']); }else { echo "<p>Invalid Search Engine!</p>"; } } ?>
-
Ha, my error pick up was right off the bat didn't look at the beginning of the code.
unset is to basically remove anything tied to the variable. For instance
unset($_SESSION['username'])
You want to do something like:
<?php if(isset($_GET['ID'])){ echo "Tracked" . htmlentities($_GET['ID']); }else { echo "Title from the First page"; } ?>
-
<?php if (unset($_GET['ID'])){ echo 'Title from the First page'; } else { if (isset($_GET['ID'])) echo 'Tracked' . $_GET['ID']; } ?>
-
mysql_real_escape_string should be all you need for input, but for output you could use those.
-
What version of PHP are you running. As far as I know these errors are common in PHP4
-
What I interpreted
<?php $array = array(1,1,0,1,0,0,0,1,1,1,0,1); echo '<table cellspacing="3" cellpadding="3">'; function a($n,$x){ if($n == 1) return '<input type="radio" name="'.$x.'" value="1" CHECKED /> Yes • <input type="radio" name="'.$x.'" value="0" /> No'; else return '<input type="radio" name="'.$x.'" value="1" /> Yes • <input type="radio" name="'.$x.'" value="0" CHECKED /> No'; } $x = 1; foreach($array AS $set){ echo "<tr><td>Answer:</td><td>".a($set,$x)."</td></tr>"; $x++; } echo "</table>"; ?>
Login works on Firefox, but not other browsers.
in PHP Coding Help
Posted
Optometrists are doctors of optometry
Opticians are the ones who make the lenses.