-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
Ignore first half of last post, but there's your problem... Adam
-
Well just cut and paste the function into a new file and test it out, eg: <?php function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $type = substr($str,$i+1,$l); return $ext; } print getExtension('testfile.jpg'); ?> if it works properly should return "jpg", but possibly could be returning ".jpg" ?? You could use something MUCH simpler like: function file_extension($filename) { $path_info = pathinfo($filename); return $path_info['extension']; } Adam
-
Does it say "wrong file type" .. or does it say .. "Unknown file extension! Only .gif, .jpg, .png, pdf and dwg and files are allowed to be uploaded" ?? Have you double checked the function getExtension is returning the right value? Adam
-
Yeah, building on what they've said... When you get to: $row = mysqli_fetch_assoc($result); extract($row); header("Location: http://localhost/webapp/logingreet.php?user_name=$row[userid]"); Use: $row = mysqli_fetch_assoc($result); $_SESSION['user_name'] = $row['user_name']; header("Location: http://localhost/webapp/logingreet.php"); Change the query to: $query = "SELECT * FROM users WHERE userid='$_POST[user_name]' AND pwd=md5('$_POST[password]')"; (note * .. which means select every field) Then on logingreet.php: <?php session_start(); if ( isset($_SESSION['user_name']) ) { echo "Hello,{$_SESSION['user_name']}Welcome to the secret page"; } else { echo "Not logged in!"; } ?> ... not forgetting session_start() at the start of each page. Hope that sheds a little more light on things?? Adam
-
<?php echo "Hello,{$_GET['user_name']}Welcome to the secret page"; ?> All you're doing here is outputting $_GET['user_name'], which is whatever they enter in the URL ?
-
You're not making a lot of sense - "it will result in a blank page in the middle", ey? what do you mean blank pages? Like for example if there was no id=5 and you've gone to .php?id=5, it would be a blank page? Could just not link to them? or to stop the pages being blank perhaps output an error? Wouldn't be much use in storing them in another query to be honest, don't think it's possible to sort of temporarily save the results and access them in another query without literally saving them in another table? But that would be pointless? Could store them in an array if you really wanted though? An when you say sorted, do you mean so the IDs are all sort of flowing ie. 0 1 2 3 4 5 6 7 ... or do you mean by category? If its by category could just use: ALTER TABLE tableName ORDER BY category If it's flowing I'm not a 100% but I don't think it's possible with a simple query? But could loop thru the results and sort of rearrange them that way, probs get a little messy but would be a soloution.. Try and explain things better.. Adam
-
[SOLVED] seperating an array retireved from a database
Adam replied to mindstorm's topic in PHP Coding Help
Never really worked with oracle before so can't say a great deal.. but if you show a little more code just sorta how you retrieve the array from the db, might be able to help you bit more.. Adam -
I assume it's to build a js function? I imagine you'll need quotes around $type value aswell?? Using kens code.. <?php echo '("' . $Type . '",0,"' . $Say . '")'; ?>
-
Mouseover on <input type="text" name="StartTime" />
Adam replied to grahamb314's topic in Javascript Help
Could perhaps use title="" ?? Or could develop your own custom popup or something with javacript? Adam -
Could use javascript... something like: <body onload="document.forms[0].inputName.focus();"> ?? Adam
-
Can echo a variable in any way you like, but unless you've literally set the variable (ie. $var = 'something' .. $var has absoloutley no value, the script cant guess or assume the value... Adam
-
try: $text = 'Sample text' ."\n". 'Sample text';
-
Okay, well it should be. Most likely a problem else-where.. what error are you getting? Adam
-
Perhaps "TEXT"? Could set the character set to UTF-8 aswell, just to make sure? Though I'm no expert at all with character sets... Adam
-
With that he means that if you had purchased some web space off a company and they provided your PHP / MySQL .. In that case you could contact them to get the login name, but with what you have installed I can't see no reason why it wouldn't be root at all... ? Does it not work? Adam
-
I've come up with a soloution using PHP, but I'd still like to know if there is such a thing in MySQL? would make the code a little nearer, and may help me on another project... $resSQL = "SELECT * FROM reservations WHERE (datefrom BETWEEN '{$year}/{$month}/01' AND '{$year}/{$month}/{$daysInMonth}')"; /* If ALL sites selected do not specify site in query */ if ($site != 'ALL') $resSQL .= "AND site = '{$site}'"; Cheers, Adam...
-
Sure.. $resSQL = mysql_query("SELECT * FROM reservations WHERE (datefrom BETWEEN '{$year}/{$month}/01' AND '{$year}/{$month}/{$daysInMonth}') AND site = '{$site}' ORDER BY datefrom ASC") or die(mysql_error()); That's the query I'm using. Most of it doesn't really matter right now except "AND site = '{$site}' " .. I have a drop down menu that allows them to select site 1, site 2, site 3, etc. the sites are stored in the database by IDs .. so the value of $site would equal 1, or 2, or 3, etc. except there's an option for ALL, so I was wondering if there was some special operator or something I could enter in the $site variable in order to - in english - return records with 'site' field equalling anything. Any clearer?? Thanks! Adam
-
Hi guys. I was just wondering if there's some kind of operator or something that can mean the field can equal any value? Basically I select records based on the 'site', but there's an option for all. So without having to go.. if ($site = 'all') //run this query else //run this query I could either have it return records from site 1, site 2, etc. or have it return records with any value for site.. Hope that makes sense?? Cheeers, Adam...
-
Well because you're echoing out the $text variable you can't just return the value at the end. You could try saving the outputs into one string, or an array, and then return that? To return a value simply add "return $varname;" to the end, or wherever in the function. The function will stop when it reaches return... Then you'd use something like: $text = edit($id); Adam
-
Best way to merge together tables with conflicting ids
Adam replied to tibberous's topic in PHP Coding Help
Well there's no way to have two records with the same unique ID. Some are just going to have to change? Adam -
Perhaps the problem... echo $row['columnName']; ...did you replace "columnName" with an actual field name from your table? Adam
-
Okay try checking if there's an error with the mysql: $Num = mysql_query("SELECT * FROM `users`") or die(mysql_error()); $Num = mysql_num_rows($Num) or die(mysql_error());
-
I tested it without the MySQL and it worked fine, I can only imagine its either that or you don't have the GD library installed on your version of PHP, is it a free host you use? Adam
-
Okay firstly, just as a heads up you don't need... <?php include_once('includes/header.php'); ?> <?php include_once('includes/menu.php'); ?> <?php include_once('includes/side.php'); ?> <?php if (isset($....... you can just use... <?php include_once('includes/header.php'); include_once('includes/menu.php'); include_once('includes/side.php'); if (isset($........... ------------- Try adding some static text to the echo to see if it it's something to do with setting up the array.. like... if(array_key_exists($_GET['pg'], $breadcrumb)){ echo 'Breadcrumbs: ' . $breadcrumb[$pg]; } else{ echo 'This breadcrumb does not exist'; } Adam
-
Not sure why your so stressed out about it? And no, not a foreach loop.. not sure wether you require the DThreads function to be seperate? But that could easily be added to the DisThread function, which itself could be cut down to far less lines.. for example: function DisThread() { $tt = mysql_query("SELECT * FROM Threads") or die('SELECT Error: ' .mysql_error()); $count = mysql_num_rows($tt) or die('COUNT Error: ' .mysql_error()); while ($Thread = mysql_fetch_assoc($tt)) { $this->DThreads($Thread); } } Adam