ldb358
Members-
Posts
199 -
Joined
-
Last visited
Never
Everything posted by ldb358
-
what version of php are you using when i run it on 5.3 it works but if i would have to guess i would say your on an older version of php because if you look here http://php.net/manual/en/language.oop5.static.php it says that the first method of calling a static function was added in 5.3
-
Will they always be in sets of 2 words?
-
okay post the code and ill take a look
-
no you should just create one column and store the $tag variable in it and then you'll have a list of tags that you can later search
-
change the name of them to: <input name="tag[]" type="checkbox" value="accident" /> <input name="tag[]" type="checkbox" value="airport"/> <input name="tag[]" type="checkbox" value="airtoair"/> then you can loop through it like so: $tags = new Array(); foreach($_POST['tag'] as $tag){ if($tag){ tags[] = $tag; } } $tag = implode(',',$tags); then inset the $tag variable in your database as text
-
Changing a variable for every item in a MySQL Table
ldb358 replied to kyles0623's topic in PHP Coding Help
UPDATE users SET id=id-1 WHERE id>$post_id Where $post_id = the id of the post deleted -
your condition should look like this: if ($random == 0) { $a = 0; $a++; }
-
try: <?php $data = 'Pulp Fiction'; $out = substr($data, 0, 7); if(strlen($data > 7){ $out .= '...'; } echo $out; ?>
-
you could do something like this: <?php $string = "The quick brown fox jumps over the moon to discover that it really wasn't the moon at all but a big rock in the ground"; $delimiter = "discover"; $maxlenth = 15; $new = substr($string,strpos($string,$delimiter)-$maxlenth,$maxlenth*2+strlen($delimiter)); ?>
-
okay thank you for you help
-
okay thanks i am reading up on openVZ, it seems to be exactly what i was looking for. What exactly do you mean by this? I am assuming you mean site traffic, which should be pretty low as i will only be running a portfolio and blog on it
-
i dont get what your asking i guess because if the value != 0 that is what it is supposed to output
-
I currently have a desktop that was great but after i got my laptop has gotten little use, so i am thinking about making it into a vps web server where i will provide the server and my friends will pay for the internet connection the specs are: 750gb hard drive (would like to partion it in to 3 separate vps') 8gb ram 2.2 amd quadcore my questions are: a)Are these specs good enough? (i would assume so but you never know) b)what software would i need to do this?(i want to run a ubuntu server) c)Any other advise?
-
try: $test = $database->query($status); $row = mysql_fetch_array($test); if($row['status'] == '0'){ if that doesn't work what mysql class are you using?
-
try adding: $test = $database->query($status); echo $database->error; //check if there is a mysql error var_dump($test); //check if its returning an object
-
if i understand your question properly you can connect to the same mysql server from different site
-
you have a typo: $q2 = mysql_query("INSRET INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '$gameid', '$players')") or die(mysql_error()); //should be $q2 = mysql_query("INSERT INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '$gameid', '$players')") or die(mysql_error());
-
your checking whether the object == 0 you need to add: $test = $database->query($status); $row = $test->fetch_object(); if($row->status == '0'){
-
okay i get on that thanks
-
by links do you mean the ones on the menu bar, side bar or all of them?
-
hey i just launched my new site and im looking for some feed back both on the design and the content it is located here: http://lanesportfolio.com/blog/ thanks in advance
-
reading an xml file and parsing into variables
ldb358 replied to MidOhioIT's topic in PHP Coding Help
as stated above use simpleXML a quick example: $xmlfile = 'file.xml'; $xml = simplexml_load_file($xml); $images = array(); foreach($xml->pic as $link){ $images[] = $link->image; } -
fairly basic php question, regarding a simple log-in system
ldb358 replied to js09's topic in PHP Coding Help
yeah sorry i missed that -
fairly basic php question, regarding a simple log-in system
ldb358 replied to js09's topic in PHP Coding Help
okay your setting it in the wrong place, what you need to do is replace: session_register($myusername); session_register($mypassword); //with $_SESSION['username'] = $myusername; $_SESSION['password'] = $mypassword; so your final script would look like: <?php ob_start(); $host="localhost"; // Host name $username="xx"; // Mysql username $password="xx"; // Mysql password $db_name="xx"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); // Define $myusername and $mypassword // To protect MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['username'] = $myusername; $_SESSION['password'] = $mypassword; header("Location: /clients/".$myusername."/"); } else { echo "Wrong Username or Password"; ob_end_flush(); ?> and your other script should look like: session_start(); if(isset($_SESSION['username']){ header("location:../../index.php"); } -
i'm 17 now and when i joined i was 16