-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
$token? do you mean $tokens? that is defined? post your code i dont know what your talking about
-
OH GOD GHOSTS But yeah.. what are the errors you are receiving, and post the code for that page. Can't really help without more information. As far as your "Ghost" You are going to have to provide some code where the ghost is or describe it more. I honestly don't understand what you are describing at all.
-
probably would help if you echoed the mysql query (with an or die or something) but it seems that this $query = "INSERT INTO Stacks"; $query .= "(`username`,`hyperlink`,`name`,`summary`,`info`,`keywords`,`ip`,`posted`) VALUES ('$username1','$url','$name','$description','$description','$keywords','$ip',NOW())"; would create a string that looked like $query = "INSERT INTO Stacks(`username`,`hyperlink`,`name`,`summary`,`info`,`keywords`,`ip`,`posted`) VALUES ('$username1','$url','$name','$description','$description','$keywords','$ip',NOW())"; you may want to put a space between Stacks and the parentheses.
-
function getScoreAndCity($string){ $tokens = explode(" ", $string); $name = array() foreach($tokens as $token){ if (is_numeric($token)){ $score = $token; } else { $name[] = $token; } } $name = implode(' ', $name); return array($name, $score); } Untested, but it should be about right
-
oh yeah sorry, that won't work with a space between the city name. it will work for things like Ohio 65. let me make one that will work for getting the city name.
-
to split home team and home score, just do $string = "New York 56"; $tokens = explode(" ", $string); echo "Home team: " . $tokens[0] . " Score: " . $tokens[1]; //echos Home team: New York Score: 56
-
you would want to make an html array, like <input type="file" name="files[]" /> <input type="file" name="files[]" /> and in PHP, you would upload them in a loop, like so for ($i = 0; $i < count($_FILES['files']['name']; $i++){ //i access each individual files stuff like so $name = $_FILES['files']['name'][$i]; $size = $_FILES['files']['size'][$i]; //upload it now for the button click, you will need javascript. You could surround the input file field with a div, and use javascript, and the innerHTML attribute of the div (gotten by document.getElementById()) to add another file field
-
well you have the insert command. What you need to do is use an HTML form to send data to a page. then using the $_POST or $_GET array (depending on if your method was post or get) you can then take that data, and insert it into the database via the insert command you have (changed to have the data from the post/get array instead of hard coded values of course) for captcha you can go here
-
delete FROM testtable WHERE text="" ?
-
[SOLVED] type checking (is_numeric vs. is_string)
mikesta707 replied to nicholasstephan's topic in PHP Coding Help
try is_int() -
if(isset($_POST['Submit'])){ if($_POST['host'] =="") { echo"Please Fill Out the Host Filed"; } if($_POST['user'] =="") { echo"<br>Please fill Out the Username Filed"; } if($_POST['pass'] =="") { echo"<br>Please Fill Out the Password"; } if($_POST['db_name'] =="") { echo"<br>please fill Out the Databases name"; } You want to exit the script when those if statements run true. if you don't, as it is now, it will just tell you you should fill out what ever field, but still do the query. if(isset($_POST['Submit'])){ if($_POST['host'] =="") { echo"Please Fill Out the Host Filed"; exit(); } if($_POST['user'] =="") { echo"<br>Please fill Out the Username Filed"; exit(); } if($_POST['pass'] =="") { echo"<br>Please Fill Out the Password"; exit(); } if($_POST['db_name'] =="") { echo"<br>please fill Out the Databases name"; exit(); } you could also do something like $error = false; if(isset($_POST['Submit'])){ if($_POST['host'] =="") { echo"Please Fill Out the Host Filed"; $error = true; } if($_POST['user'] =="") { echo"<br>Please fill Out the Username Filed"; $error = true; } if($_POST['pass'] =="") { echo"<br>Please Fill Out the Password"; $error = true; } if($_POST['db_name'] =="") { echo"<br>please fill Out the Databases name"; $error = true; } if ($error){ exit(); } if you wanted to get all the error messages
-
every time that page is run, whatever you want run will be run because you reset the $lastRun variable.
-
do you check if the post has been submit? you can do so by doing something like if (isset($_POST['submit'])){//you can replace submit with whatever form should be set //do error message thing } edit: beaten to the punch
-
Get data from multiple tables and put in Columns
mikesta707 replied to travelkind's topic in PHP Coding Help
look into Join clicky -
post the relevant code. im not (and apparently no one else) wants to wade through lines and lines of code to find one problem.
-
let me get this straight. when you put WHERE teminated=0 it retrieves the rows that have terminated with a value of 1. that doesn't make any sense. are you sure the fields in your database are how you expect them to me EDIT: ok i was about to say
-
try it without the quotes around 0. its probably an integer column, and single quotes means a string
-
oh my bad didnt see it was a text area. instead of .value do .innerHTML
-
is the urlarea variable already defined? if not you have to do document.getElementById('urlarea').value = url;
-
you can use javascript. it can get the location of the frame like so url = parent.frameName.location.href;
-
How do I create unique meta information in <head> for each page
mikesta707 replied to bgbs's topic in PHP Coding Help
whats so hard about drawing data from a database? just a simple select statement. what does your inc.header.php page look like right now? Instead of hard coding the meta data in you could just get it from a data base, and echo variables that hold the meta data -
Anonymous functions are available in PHP5.3+ ahh ok. I always wondered when they would add those in.
-
I don't quite understand what you mean by GET the url. Do you mean put it in a GET variable? retrieve it? Could you explain your problem a little better
-
you should create a table in whatever database you use, and when you register a user add them, and the relevant information to the database. Remember to have some sort of unique identifier (usually in the form of an integer id field that is set to auto increment)