708 Posted Topics
Re: You can also do: [code] $query = mysql_query("SELECT * FROM table"); while( $arr = array_map('stripslashes',mysql_fetch_array( $query )) ) { echo "ID: {$arr['id']} VALUE: {$arr['value']}\n"; } [/code] | |
Re: You have parenthesis around the REMOTE_ADDR. It thinks you are trying to call a function with the name of the value of $_SERVER (which is an array) thus causing your "function must be a string" error. | |
Re: Captchas are annoying. You can easily just use form timeouts and tokens. They actually work better. | |
Re: Or you can look around on the php.net manual and find the nice [icode]dirname[/icode] function. | |
Re: This is kind of pointless, because anyone with a little knowledge of php can easily go in and remove the part of the code that checks if the page is licensed or not. | |
Re: You shouldn't have a multiple tables that serve the same purpose. Even though the organization is better, it hinders performance. You should have a blog table that holds the different blogs and assigns an id to each one (via auto_increment). Then you have a post table that handles all post … ![]() | |
Re: Can you post an example of the data you are parsing? | |
Re: Its a mysql error. Read the mysql manual about DELETE. The answer is pretty obvious. | |
Re: First of all don't do that. You don't have anything validating the data. This creates a problem. Anyway, all you have to do is replace the ' with " in the header function. | |
Re: i think the item you are evaluating is an object and needs to converted to a string to be read like that. maybe this will work (just a guess) [code] if (gettype($var) !== 'string') { if (settype($var,"string")) { echo $var . ' set to string'; } else { echo $var … | |
Re: Your problem stems from that the fact that php will try and convert anything that is not a number into a number when trying to add it (the +=). Most of the time, it just turns into a nice 0. Remove the plus sign. | |
Re: Read the page data, format it, and get the data you need. file_get_contents is a good place to start. Use fopen ect for older versions of php. | |
Re: Either use the ingenious function like [icode]is_numeric()[/icode] which checks if certain data (like an id in a url) is a number or use type-casting which will convert it to one no matter what. Also, the [icode]mysql_real_escape_string()[/icode] function was made for a reason. | |
Re: Please read the freaking manual. [url]http://us.php.net/array_unique[/url] | |
Re: Look into [icode]func_get_args()[/icode]. Kind of what you are looking for. | |
Re: I think you are going about this the wrong way. Just use a regular auto_increment primary key field and then store the year in the rows themselves under a 'year' column. Or you can just store the time the project was created in the database, which you can easily derive … | |
Re: Replace ” or “ with " (just a regular quotation). Replace ’ with ' (just an apostrophe) ![]() | |
Recently, I started on a new venture in which many sites will be built off the same base files. Pretty much if I change one file it will affect all of my sites. This has its ups and downs, but since the ups outweigh the downs I am going to … | |
Re: Use a cron job to set users offline after a certain amount of time. Just have it run every 5-10 minutes and that will solve the problem without having to rely on javascript to do it (which is not a good thing to do). | |
Re: Are you talking about PayPal IPN? If so, they have an api that validates the data they post to your site. You will just have to spend an hour trying to figure out where they hell the put it on their site. | |
Re: Instead of [icode]<?=$prod_options;?>[/icode] try [icode]<?php echo $prod_options; ?>[/icode] | |
Re: Before you append to a variable you need to first define it. Just add [icode]$prod_options = '';[/icode] and [icode]$color_options = '';[/icode] before their respective while statements. Also, that is just a notice. Not really an error. You can get rid of them by changing error reporting settings. | |
Re: Sorry it took me so long to reply. I have been busy. Put: [code] echo '<pre>' . print_r( $_POST,true ) . '</pre>'; [/code] somewhere on the page to check to make sure the post data is correct. Then put: [code] echo '<pre>' . print_r( $items,true ) . '</pre>'; [/code] towards … | |
Re: This should work as long as you have an id field in the item table (which you should): [code] <?php $page_title = 'Place A New Order'; require_once('startsession.php'); require_once('header.php'); require_once('appvars.php'); require_once('connectvars.php'); require_once('navmenu.php'); $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $items = array(); $query = mysqli_query( $dbc,"SELECT `ItemID`,`ItemName`,`ItemCat`,`ItemPrice`,`ItemAmount`,`ItemUnit` FROM `items` ORDER BY `ItemCat` … | |
Re: You can use magic methods to do it if you have php5. [url]http://us.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.methods[/url] I won't go into anymore depth, it's all there. | |
Re: Those are called superglobals and they will work inside a class. Also the way you called the method in the if statement is incorrect. I hope you know that. FYI: _POST and _GET are part of _REQUEST. Make sure you use the specific request type. Using _REQUEST isn't the best … | |
Re: Look into the [url=http://www.php.net/date]date[/url] function. Please search for a solution before create a thread. | |
Re: You can but its not recommended. Its better to store them on the server. You can read the file contents into a longblob field in a database. To retrieve it you need to get the contents from the database, then echo it out to the browser with the correct headers. | |
Re: What you are looking for is pagination. Google it and you will find plenty of websites to help you. ![]() | |
Re: [QUOTE=dwdata;913680]Oddest thing??? This is my CODE: [CODE] // Get all the Emails to include for a BBC bulk email $query = "select Email FROM Ev_SchVolunteers WHERE id_Event='$id_Event'"; print_r($query); $results = mysql_query($query) or die("Error performing query"); //print_r($results); $bcc_email = mysql_fetch_assoc($results); $index = 1; $BCC = ''; $email_count = count($bcc_email); print_r($bcc_email); print_r($email_count); … | |
Re: Why does it have to be setup that way? Usually there is a much simpler solution. | |
Re: Why not use ajax? Its better than having php create the javascript which adds to the page size and load time. | |
Re: Security is a big deal for me. I hate seeing code with holes in it and how easily it would be for someone to hack it. I have a good login security login example I can post. If you want to see it let me know. As for your question, … | |
Re: Can we see the code that generates that error? Some simple logic changes should fix the problem. | |
Re: You need to change the name of the instrument select element to "Instrument[]". Then when adding to the database run [icode]implode(',',$Instrument);[/icode] because it will return an array of selected elements. Implode will put them into a comma separated string so it can be put into the database. On the update … | |
Re: I wouldn't use a regular expression for something like this. I am not the best with it and a php function to do it wouldn't be hard. [code] function splitString( $data,$len=50 ) { $data = explode( ' ',$data ); $result = array(); $i = 0; foreach( $data as $str ) … | |
Re: From what you are saying, it sounds like you are wanting the br tags to be added as they type. This isn't possible with php. You would need to run nl2br() once the form is submitted. If you are looking for that type of solution (which would be pointless, because … | |
Re: I have never had a problem with cache and the header function. I have updated your code by simplifying your code and making it more secure. I hate seeing so many security holes in peoples code. [code] <?php ob_start(); session_start(); include '../../includes/dbconnect.php'; $allowed = array( 'jpg','jpeg','png','pdf' ); $maxsize = 50000; … | |
Re: I am guessing you never echoed $go to the page. If you would have, you would of noticed that $_SERVER['SERVER_NAME'] doesn't include http:// which would make that header call fail. | |
Re: You will need to use ajax to do this. There are many examples on the internet, google it. | |
Re: What is your database layout like? How are you handling the children? Do you have any logic in place for those. | |
Re: Thats just css. Read up on the background selector. | |
Re: Things needed to program in php: 1. XAMPP. I have found this to be the easiest to get running on a windows system. If you get into php programming, get an old computer and put linux on it (I use Ubuntu). Nothing is easier than installing php and mysql on … ![]() | |
Re: You could do it all on the same page. Just put an variable in the url to tell whether or not the show the registration form. | |
Re: I think this is what you are talking about: [code] function create( &$var ) { $var = new $var; } [/code] to use define a variable and then call the function [code] $class = 'class_name'; create( $class ); echo $class->testing; [/code] | |
Re: I wouldn't change the session timeout. I don't think its a good idea to keep a session going that long. You might want to look into cookies to solve that problem. | |
Re: Your code didn't show errors because @ suppresses errors. Remove it and errors will show. | |
I am working on a personal framework and I have been trying to move all of my configuration variables into one central file and read them from there. I created a config class that traverses a large array, but I feel as I add more configurations to the application, its … |
The End.