
Alex
Staff Alumni-
Posts
2,467 -
Joined
-
Last visited
Everything posted by Alex
-
It would be nice if you could post the error so we can see where it's occurring.. You should also use php tags next time. edit: Does this look right to you? echo "$row2[friend]echo "<form method=post action=http://www.solent.edward.ac.uk/~FoshRachel/dissertation/otherprofile.php?friend=$row2[friend]><input name=Profile View input type=submit value=Go></form>";<br/>"; You can't combine two echos like that. echo "$row2[friend]<form method=post action=http://www.solent.edward.ac.uk/~FoshRachel/dissertation/otherprofile.php?friend=$row2[friend]><input name=Profile View input type=submit value=Go></form><br/>";
-
This forum is for asking specific questions that can't be found by using Google.
-
Query in PHP doesn't work but run in PHP MyAdmin works
Alex replied to michaelkirby's topic in PHP Coding Help
You're missing a pair of quotes. $query="select * from users where towncity= 'Maidenhead' and fname = '$search_text' or organisationname ='$search_text' or surname ='$search_text'"; -
Something like this should be done in JavaScript.
-
using end() to get last file name out of array.
Alex replied to denoteone's topic in PHP Coding Help
$last = end($images_new); echo $last['name']; -
$var++ will return the current value of $var then increment it. Use ++$var, which increments and returns the current value, to get the result you expect.
-
There are PHP compilers that are capable of compiling PHP into standalone executables. One such compiler is Roadsend, this supports PHP GTK 1, but not PHP GTK 2. If your goal is to be able to distribute a single installation file for convenience there's no need to compile into a standalone executable. You can create a simple batch file to launch the program, and use any of the many free available programs to package it into a single setup file.
-
You should never use PHP_SELF as a form action as it leaves you vulnerable to XSS attacks. Instead just write the name of the file.
-
Greater than Operator and Multipying a Variable
Alex replied to aeafisme23's topic in PHP Coding Help
You shouldn't have quotes around it, you don't want a string, you want it to perform the mathematical operation. $dvd_cost = 15.00*$dvd_quantity; -
Anonymous functions aren't available until PHP 5.3.0, if you were writing that code for a system with PHP 5.3.0 or higher installed you might do it this way: list($date, $h_a, $w_l_t, $us, $them, $vs_team) = array_map( function($x){ return $x == null ? " " : $x; }, explode(",", $game_result) );
-
empty returns true for 0, so compare it against null instead. list($date, $h_a, $w_l_t, $us, $them, $vs_team) = 'hi,ho,hl,0,hm,hn'; $arr = array_map( create_function( '$x', 'return $x == null ? " " : $x;' ), explode(",", $game_result) );
-
You need to be more specific. Have you done any debugging that tells you where it's going wrong? The first thing that jumps out at me is that you're relying on register_globals which is depreciated and not suggested. $file = $_POST['FN'];
-
Try: list($date, $h_a, $w_l_t, $us, $them, $vs_team) = array_map( create_function( '$x', 'return empty($x) ? " " : $x;' ), explode(",", $game_result) );
-
In the database table for the articles you should have a column used to specifiy whether or not the article has been approved. Say, 0 for unapproved and 1 for approved. By default you can have this column set to 0. You can then create a simple page where you select all of the records from the database that are unapproved (approved = 0) so they can be approved by an administrator. The page that displays the articles would only select articles that have been approved.
-
You need to use a where clause. Example: $sql="SELECT * FROM $tbl_name WHERE cat='general' ORDER BY fid";
-
Why did you place the column names in quotes? That's not needed, perhaps you meant to use backticks (`)? Backticks aren't even required, and not suggested, unless you're using reserved words for your column names which you really shouldn't be doing in the first place.
-
$_SERVER['REQUEST_TIME'] is a unix time stamp, as such you can format it using date.
-
Your problem is that you're trying to access the members of the array as if it's a multidimensional array, which it's not. function convert_emoticons($textstring){ include("emoticons.php"); foreach($emoticons as $symbol => $filename) { $textstring = str_replace($symbol, '<img src="images/emoticons_' . $filename . '>', $textstring); } return $textstring; }
-
You can mark the topic as solved by clicking the button to do so at the bottom of the page.
-
If you're using Apache you can rename the file image.png and create a .htaccess file like this: <Files "image.png"> AddType application/x-httpd-php .png </Files> To have image.png parsed as a php file.
-
can somene tell me what is wrong with this simple code?
Alex replied to starvator's topic in PHP Coding Help
Small typo on my part, sorry. <?php if($session->logged_in){ echo '<embed height="200" width="90%" src="http://en.gagalive.com/livechat2.swf?chatroom=leetgiveaways&user=' . $session->username . '"></embed>'; } else { echo '<embed height="200" width="90%" src="http://en.gagalive.com/livechat2.swf?chatroom=leetgiveaways"></embed>'; } ?> -
can somene tell me what is wrong with this simple code?
Alex replied to starvator's topic in PHP Coding Help
<?php if($session->logged_in){ echo '<embed height="200" width="90%" src="http://en.gagalive.com/livechat2.swf?chatroom=leetgiveaways&user=' . $session->usrername . '"></embed>'; } else { echo '<embed height="200" width="90%" src="http://en.gagalive.com/livechat2.swf?chatroom=leetgiveaways"></embed>'; } ?> -
can somene tell me what is wrong with this simple code?
Alex replied to starvator's topic in PHP Coding Help
You can't just place html anywhere. Just like you echoed 'hi' you needed to echo the html. -
Single quotes don't have variable interpolation. echo '<input type="hidden" name="currency_code" value="' . $currency_iso_GBP . '">';
-
can somene tell me what is wrong with this simple code?
Alex replied to starvator's topic in PHP Coding Help
Did you fix what Nightslyr added? <?php if($session->logged_in){ echo '<embed height="200" width="90%" src="http://en.gagalive.com/livechat1.swf?chatroom=LeetGiveaways"></embed>'; } else { echo "hi"; } ?>