wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
Then do this: [code] $name = 'NULL';[/code] If you define a variable as NULL the value of the variable is set to nothing. If you want the variable to store the actuall value NULL (as-is) then surround it in quotes. Therefore when it goes into your query it should place NULL into your query if the $_POST['name'] is empty.
-
Something like: [code]<?php if ( $_SERVER['HTTP_REFERER'] == 'http://www.ts25.com/surf/surf.jsp ) { echo '<a href="Home.html" target="_blank">English</a>'; } else { echo '<a href="Home.html">English</a>'; }[/code]
-
Change this code: [code]$_SESSION['loggedIn'] = true; /*while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $userGroup = $row['user_group']; echo $userGroup; session_register("userGroup"); //is this really needed? $_SESSION['userGroup'] = $userGroup; }*/ header("Location: ".$url);[/code] to the following: [code]$_SESSION['loggedIn'] = true; $row = mysql_fetch_array($result); $_SESSION['userGroup'] = $row['user_group']; header("Location: ".$url);[/code] Also I see yoou have the following: [code]<!--HEADER GOES HERE--> <?php[/code] Is that going to be HTML where <!--HEADER GOES HERE--> currently is? If it is then session_start will fail to work and your header redirect will fail too. As these function require no output before the use of those functtions.
-
Something like this: [code](($foo == null) ? $bar = null : $bar = $foo);[/code] Basically that checks whether the $foo variable is null, if it is it'll set $bar as null, otherwise if $foo is not null it'll set $bar as the value of $foo. If it isn't could you explain what your are trying to do in much more detail and if you have any PHP code then paste that here too which will be able to aid in a better answer rather than us having to guess.
-
Did you create the mycards variable outside of the function? If you did you need to add the following bit of code after you define your function: [code]function shufelmycards() { global $mycards; // add this line![/code] Now your function will be able to access the $mycards variable. Variables dont have global scope when being used inside a function. In order for your variables to be accessable from the function you need to declare them as global.
-
Umm, can you explain that a bit more please! I dont get what you mean.
-
yes make sure you use htmlspecialchars or strip_tags on the variable that stores the data that was submitted from the textbox.
-
You should turn on error_reporting in the php.ini file that way PHP now show any errors that occure, complete with where about the error is. Also for a GUI for MySQL you have two options. You can download either MySQL Administrator and/or the MySQL Query Browser from [a href=\"http://www.mysql.com/products/tools/\" target=\"_blank\"]mysql.com[/a]. Or another alternative is web based PHP script called [a href=\"http://www.phpmyadmin.net/home_page/index.php\" target=\"_blank\"]phpMyAdmin[/a].
-
You can only close a window with javascript so you'll want to use this: [code]echo "<script type=\"text/javascript\">window.close();</script>";[/code]
-
javascript doens't have a real SLEEP() function does it?
wildteen88 replied to play_'s topic in Javascript Help
You'll want to use setInterval like so: [code]<script type="text/javascript"> var size = 500; function resize() { var resizeInt = setInterval("resizeDiv()", 10); } function resizeDiv() { if(size >= 100) { size = size - 1; document.getElementById('test').style.height = size + "px"; } } </script> <div id="test" style="border:1px solid red; height:500px; width: 500px;"></div> <input type="button" id="1" onclick="resize()" value="resize" />[/code] -
Change the following: [code]'<img scr="\\2" />');[/code] to the following: [code]'<img src="\\2" />');[/code] basically you typed [b]scr[/b] instead of [b]src[/b] just a simple type
-
try this: [code]$bb_replace = array ('/(\[[Bb]\])(.+)(\[\/[Bb]\])/', '/(\[url=)(.+)(\])(.+)(\[\/url\])/', '/(\[img\])(.+)(\[\/img\])/'); $bb_replacements = array ('<b>\\2</b>', '<a href="\\2">\\4</a>', '<img scr="\\2" />');[/code] basically you forgot to add the ending delimiter which is the backslash '/'
-
From looking at the code it looks like you can supply a url prarameter called return To do so you need to open up a file called [b]mod_login.php[/b] for editing which is in the [b]modules[/b] folder. Scroll down to line 75 and you should find this: [code] <form action="<?php echo sefRelToAbs( 'index.php' ); ?>" method="post" name="login" >[/code] change that to the following: [code] <form action="<?php echo sefRelToAbs( 'index.php' ); ?>?return=pagename.php" method="post" name="login" >[/code] change where it says [b]pagename.php[/b] to the actuall file you want the users to be redirected to when they login. I'm not sure that is the correct way to do it but have a quick look at the code it seems thats the way to do it. You can always ask how you can do such a thing over at the offical [a href=\"http://forum.joomla.org/\" target=\"_blank\"]joomla forum[/a]
-
If thats the result you are getting then you may not be coding your HTML correctly. include does what it is told to do, include a file thats it! The way you want the menu to look like is down how you style or code your HTML. Post your code here and we might be able to help. There is another alternative which is require but it'll probably do the same thing as include does.
-
I see nothing wrong with your code. But you might want to check through this list just incase for troubleshooting:[list][*]Does your setup PHP support short tags (<? ?>) try you script with normla php tags (<?php ?>) [*]Make sure PHP is making a succesful connection to your mysql database, so chnage this code:[code]$connect= mysql_connect("localhost", "root", ""); //I have been using the root user $db= mysql_select_db("myDatabase");[/code] to: [code]$connect= mysql_connect("localhost", "root", "") or die("Unable to connect to mysql: " . mysql_error()); $db= mysql_select_db("myDatabase") or die("Unable to select database: " . mysql_error());[/code] [*]Check that their is no errors with your query. SO change this: [code]$query= "SELECT * FROM mp3"; $result= mysql_query($db, $query);[/code] to: [code]$query= "SELECT * FROM mp3"; $result= mysql_query($db, $query) or die("Unable to perform query" . mysql_error());[/code] [*]If none of those returned anything then see if your $myrow variable is being populated. So change this: [code]while($myrow= mysql_fetch_array($result)){ echo $myrow[mp3Title]; }[/code]with this: [code]while($myrow= mysql_fetch_array($result)){ echo "<pre>" . print_r($myrow, true) . "</pre><hr />"; }[/code][/list]One of those steps above should bring up some form of error which might help you to solve the problem
-
Change your code to this: [code]$bb_replace = array ('/(\[[Bb]\])(.+)(\[\/[Bb]\])/','/(\[url=)(.+)(\])(.+)(\[\/url\])/','/(\[img\])(.+)(\[\/img\]); $bb_replacements = array ('<b>\\2</b>','<a href="\\2">\\4</a>','<img scr="\\2">');[/code] And about line breaks. The line breaks are being inserted into the database, but the actuall problem is the web browser. Web browsers ignore white spacecharacters, such as newlines, carriage returns etc. To solve this you'll want to use a function called nl2br. Now use this function when you are retrireving data out of of the database like so: $var = nl2br($row['fieldnamehere']); What this will now do is convert newlines/carriage returns into their html equivilant the linebreak (< br />) tag.
-
yes you can, however you need to make sure that your setup of PHP has GD installed/enabled. Here is a tutorial for how to watermark an image with php over at [a href=\"http://www.sitepoint.com/article/watermark-images-php\" target=\"_blank\"]sitepoint.com[/a] Also heres another one too from [a href=\"http://www.devshed.com/c/a/PHP/Dynamic-Watermarking-with-PHP/\" target=\"_blank\"]devshed.com[/a] If you want to find anymore just google [a href=\"http://www.google.co.uk/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial_s&hl=en&q=watermarking+with+php&meta=&btnG=Google+Search\" target=\"_blank\"]watermarking with php[/a] hope that helps.
-
[!--quoteo(post=379179:date=Jun 1 2006, 10:02 PM:name=nphls)--][div class=\'quotetop\']QUOTE(nphls @ Jun 1 2006, 10:02 PM) [snapback]379179[/snapback][/div][div class=\'quotemain\'][!--quotec--] Btw do you also know how to access MySQL which comes with EasyPHP, too? [/quote] You can either access mysql via the command line/shell (advanced), webbased via phpyAdmin (the easy way) or you can access mysql by downloading MySQL administrator and/or MySQL Query Browser [a href=\"http://www.mysql.com/products/tools/\" target=\"_blank\"]here[/a]. Thats three ways of accessing MySQL. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Why dont you read the EasyPHP manual? Its not called Easy for nothing![/quote] Well easyPHP isn't actually easy unless you undertstand French! I find easyPHP crap.
-
You'll want to look into Ajax for that sort of thing. You can code the backend in PHP then you use AJAX that then sends a call to your php script which then populates the secound drop down menu. With AJAX it will be done in the background and doesn't require for the user to be redirected or the page to be refreshed.
-
If you want to do that then it'll require you to use [a href=\"http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html#basicredirects\" target=\"_blank\"]mod_rewrite[/a], In order to use mod_rewrite you will need to make sure your server supports mod_rewrite and that the use of .htaccess files are aloud too.
-
[!--quoteo(post=379434:date=Jun 2 2006, 07:17 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 2 2006, 07:17 PM) [snapback]379434[/snapback][/div][div class=\'quotemain\'][!--quotec--] wildteen, MySQL is actually enabled [based on what I see]. If you try to do something like: mysql_connect(...) or die(mysql_error()) it may tell you what is wrong. [/quote]Not with PHP5 isn't. As you have to enable the mysql extension in the php.ini file in order for PHP5 to use the mysql library of functions. But any way I misread the orginal post.
-
Passing a Get variable without the variable name
wildteen88 replied to jlove's topic in PHP Coding Help
Your best of looking into mod_rewrite instead. Its much easier. What mod_rewrite can do is change the following url: mysite.com/page.php?var1=hello&var2=world into something like this: mysite.com/page/hello/world a friendly URL -
Look at my thread here: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=87276\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=87276[/a] All what you need to do is enable the mysql extension which requires you to edit two lines within the php.ini nothing too complicated
-
If he declines then have another link which deletes it out of the database. Therefore it doesnt overload the database with data that is not needed.
-
For what you want to do is actually a simple process. All it requires for you to do is have an extra coloumn within the table that stores the attacments which is called [b]approved[/b] or something similar, which stores an ENUM value thats stores either Y (for yes) or N (for no) and its formated like so: [code]approved ENUM('Y', 'N') DEFAULT 'N'[/code] Now what you do is this. When a user submits attachments it goes into the database and by defualt MySQL will set value of of approved for that attement to N for no. Then when you go to display the attachements you use query like so: [code]SELECT * FROM tableName WHERE approved='Y'[/code] What will happen is, mysql will only select the rows from the table that stores the attaments that have approved field set to Y. It will not select any fileds that have it set to N Now all you need to do is send a link to the Admin of the site that contains a link which changes the value of the approved field for that attachment to Y allowing it to be deisplayed. and thats it! It requires very basic programming to achieve. Nothing too advanced. All you are doing is comparing values in a database and updating the values accordingly.