363 Posted Topics

Member Avatar for gdp_87

Hey. I would guess that it is because your fields, notably [icode]$_POST['name'][/icode], are not inside the form. If you do something like: [code=html] <input type="text" name="name" /> <form action="?" method="post"> <input type="hidden" name="id" value="1" /> <input type="submit" /> </form> [/code] Once you submit, you will only get [ICODE]$_POST['id'][/ICODE], not [ICODE]$_POST['name'][/ICODE]. …

Member Avatar for Atli
0
80
Member Avatar for jeet_portal

Hey. Because when you add a 0 to the start of an integer, PHP assumes you are using octal notation, in which the number 8 does not exist. To print 8 in that way, you would have to do: [code=php] $a=010; print $a; [/code] See [url=http://php.net/manual/en/language.types.integer.php]the manual[/url] for details.

Member Avatar for jeet_portal
1
109
Member Avatar for freshfitz

Hey. Since this is browser specific, the problem is likely not in the PHP code itself, but rather the HTML [I](or other client-side code)[/I]. You should start by fixing the HTML for the login form. Main things to consider there: [list=1] [*]A HTML document [b]requires[/b] a <head> tag, and a …

Member Avatar for diafol
0
153
Member Avatar for shishtawitch

Hey. Just wanted to point out that number should not be quoted in MySQL queries. Can cause all sorts of problems. Assuming your $id is in fact a number: [code=php] $query = mysql_query("SELECT * FROM table WHERE id != '$id' AND id!='$id_2'"); // Should be $query = mysql_query("SELECT * FROM …

Member Avatar for Atli
0
95
Member Avatar for duka96

Hey. The most likely causes for that are: [list=1] [*]You used short_open_tags without enabling them. [I](<? ... ?> instead of <?php ... ?>)[/I] [*]Your PHP files have an incorrect file extension. People new to PHP often try to add PHP code to their old .html files without changing the extension …

Member Avatar for kireol
0
198
Member Avatar for Anubhav kumar

Hey. I'm not sure exactly what you are asking for. What is the problem? Could you explain it a bit better? And perhaps show us the code that is causing it?

Member Avatar for codewalkz
-2
146
Member Avatar for sleign

Hey. You can set use the name attribute of an <input> just as you would an array inside PHP. So you can do stuff like: [code=php] <?php $result = mysql_query("SELECT id, name FROM users"); echo '<form action="?" method="post"><table>' while($row = mysql_fetch_assoc($result) { echo <<<HTML <tr> <td>{$row['name']}</td> <td><input type="text" name="cat[{$row['id']}][1]" ></td> …

Member Avatar for sleign
0
139
Member Avatar for hno

[QUOTE=SKANK!!!!!;1056378]cron jobs?[/QUOTE] Scheduled executions of commands, on a Unix based system. The Windows equivalent would be the Task Scheduler. I would have to agree with kireol. If you want something done without an outside request, it is usually best to schedule it using Cron.

Member Avatar for kireol
0
86
Member Avatar for Stefano Mtangoo

Hey. In a properly designed CMS, changing anything just INSERTs, UPDATEs or DELETEs stuff from the database. If it is actually creating tables, or otherwise changing the database structure, there is usually something wrong with the database design. Exceptions to this are webs with insane numbers of visitors, where the …

Member Avatar for Atli
2
100
Member Avatar for dannybarh

Hey. I'm happy to help [I]you write the code[/I], but I am not going to do it for you. You are going to have to do the heavy-lifting. After all, this is your project, and we are only here to help. Have you even tried to do this yourself? What …

Member Avatar for Atli
0
223
Member Avatar for web3

[QUOTE=ardav;1056425]Is this a question? What do you want? Have you contacted the host? If you see php code you've probably not enclosed the code inside php tags or perhaps your hosting account does not support php.[/QUOTE] Agreed, you need to contact your host to get your login info. Judging by …

Member Avatar for Atli
0
103
Member Avatar for darkagn

It should be, yes. You can define functions and classes withing an if block if you need to. Doing something like this is pretty common: [code=php] <?php if(!function_exists('myFoo')) { function myFoo() { echo "My Default Foo!"; } } ?> [/code]

Member Avatar for darkagn
0
224
Member Avatar for smartness

Hey. Hahses are by definition one-way, so using those in situations where decoding the data again is needed is not possible. [I](Or at least not practical.)[/I] You say you need it to be an alphanumeric string, but do you need to to be encrypted? If not, you could just send …

Member Avatar for kireol
0
84
Member Avatar for levsha

Hey. You could use sessions to store the data from the first part of the form until the second one is submitted. Or you could insert the data from the first page into the database as soon as it is submitted, have the user fill out the second part, and …

Member Avatar for levsha
0
126
Member Avatar for brandonmofiki

Hey. The fact that the file ends in .php means absolutely nothing to a RSS feed reader. [i](Or rather; a RSS reader worth using.)[/i] As far as they are concerned, if it acts like a XML file [i](uses a XML mime type)[/i] and talks like a XML file [i](uses valid …

Member Avatar for Atli
0
238
Member Avatar for lili.edryana

Hey. Try commenting out the header and see if you get any errors. (Line #10). You might have to turn on error reporting to see them, by adding this to the top of the script: [code=php] ini_set('display_errors', true); error_reporting(E_ALL); [/code] I tried you code on my test server and it …

Member Avatar for Atli
0
192
Member Avatar for coolbuddy059
Re: lamp

Hey. LAMP is a collection of popular web-sever technologies, which collectively make up the core of a majority of HTTP servers running today. It typically stands for: [list] [*][B]L[/B]inux [*][B]A[/B]pache [*][B]M[/B]ySQL [*][B]P[/B]HP/[B]P[/B]erl/[B]P[/B]ython. (One or more) [/list] See the [URL="http://en.wikipedia.org/wiki/LAMPP"]Wikipedia entry[/URL] for it. There is also the Windows equivalent, WAMP, which …

Member Avatar for coolbuddy059
0
93
Member Avatar for mrjoli021

Hey. Just thought I would point out that both the code examples above are wide open to [url=http://php.net/manual/en/security.database.sql-injection.php]SQL Injection[/url]. You two are probably aware of this fact, but other readers may not be. (Safety first! :P) Check out the [url=http://php.net/mysql_real_escape_string]mysql_real_escape_string[/url] function. Learn to love it! :)

Member Avatar for diafol
0
2K
Member Avatar for hkseo100

Hey. My spelling is particularly bad today, so let me just offer this example :) [code=php] <?php // Check if the stat has already been selected // and saved into the cookie if(!isset($_COOKIE['chosen_state_id']) || intval($_COOKIE['chosen_state_id']) == 0) { // See if a user has selected a state from the // …

Member Avatar for Atli
0
67
Member Avatar for rajabhaskar525

Hey. If you are having problems with functions, look them up in [url=http://php.net/imagewbmp]the manual[/url]. The third parameter of the [url=http://php.net/imagewbmp]imagewbmp[/url] function is not the same as the third parameter for the png function. The manual explains the difference. Even gives examples.

Member Avatar for rajabhaskar525
0
168
Member Avatar for julzk

Hey. A single LEFT JOIN should be able to do that. Consider this: [code=php] <?php // Open a database connection $dbLink = new mysqli('host', 'usr', 'pwd', 'dbName'); if(mysqli_connect_errno()) { trigger_error(mysqli_connect_error(), E_USER_ERROR); } // Create and execute the query. $sql = "SELECT j.jobs_id, d.jobs_done_id, d.jobs_user FROM tbl_jobs AS j LEFT JOIN …

Member Avatar for Atli
0
168
Member Avatar for shishtawitch

Hey. You should not stack forms like that. It is considered invalid HTML, so you can't really rely on browsers treating them consistently. Both IE7 and Firefox, for instance, flat out refuses to submit the outer-form, and if forced to do so by JavaScript, exclude the <input> elements belonging solely …

Member Avatar for shishtawitch
0
106
Member Avatar for zeusofolus

Hey. You could also do: [code=php] if(!empty($_POST['field']) || is_numeric($_POST['field'])) { // Do your thing. } // Or: if(!empty($_POST['field']) || $_POST['field'] === '0') { // Do your thing. } [/code]

Member Avatar for Atli
0
6K
Member Avatar for phpangel

Hey. Have you searched online for tutorials? There are probably hundreds of PHP/MySQL tutorials available online. I always liked the one at [url=http://www.w3schools.com/php/default.asp]w3schools.com[/url].

Member Avatar for GL.Za
0
175
Member Avatar for otherdummy

Hey. To do that, you would need to start by writing the script that checks the database and sends the emails. Then you would have to have your Operating-System execute that script at a given interval. On Unix systems, you would use [url=http://en.wikipedia.org/wiki/Crontab]Crontab[/url] to do that. On Windows you would …

Member Avatar for otherdummy
0
378
Member Avatar for OmniX

[QUOTE=network18;1046069]mysql_real_escape_string()[/QUOTE] Yep, that's pretty much it for MySQL. That is [i]the[/i] function, along with it's MySQLi counterpart; [url=http://php.net/mysqli_real_escape_string]mysqli_real_escape_string[/url]. It's also good to keep a look out for the [url=http://php.net/magic_quotes]magic_quotes[/url] feature, so that it doesn't double-escape the data. Also, it's worth noting, that functions like [url=http://php.net/htmlentities]htmlentities[/url] should not be used on …

Member Avatar for OmniX
-1
109
Member Avatar for Benjip

Hey. I just have a couple of suggestions. [b]#1[/b] Your [ICODE]$_SESSION['cart'][/ICODE] element. You can use session elements as arrays. There is no need to serialize all the items into a single element. Meaning, rather than do: [code=php] <?php function addToCart($id) { $_SESSION['cart'] .= "$id,"; } function printCart() { $itemList = …

Member Avatar for Benjip
0
194
Member Avatar for gedas

Hey. Do you have some sort of a database? Like MySQL? If not, you could use a CSV file to store the data. For example, I wrote this a while back. Does pretty much what you were talking about: [b]data_functions.php[/b] [code=php] <?php // Stores the name of the database file. …

Member Avatar for Atli
0
149
Member Avatar for bibiki

Hey. The problem is that the variable you use in the inner loop, [icode]$c[/icode], gets incremented correctly the first loop, giving you a single valid row, but when it comes to the second loop, it is already at 5, so the loop is never executed. All you would have to …

Member Avatar for bibiki
0
800
Member Avatar for web3

Hey. Creating a simple "tabs" system using AJAX is easy enough. Especially if you use jQuery, or something equivalent. You could just put the contents of all your tabs in separate HTML files, and use AJAX to load them into a <div> in your HTML. For example, assuming the following …

Member Avatar for Atli
0
135
Member Avatar for Moselekm

Hey. You would have to use AJAX to do that client-side. I wouldn't recommend that, tho. JavaScript can be turned off by the client, so having JavaScript do stuff that [i]needs[/i] to happen is not a good idea. I recommend you look into a way to do this using whichever …

Member Avatar for Atli
0
64
Member Avatar for hajjo

Hey. You just need to change the [icode]list-style[/icode]for the <ul> elements. Setting it to [icode]list-style: none[/icode] will hide the bullets. Like: [code=html] <!DOCTYPE html> <head> <title>List-Style example</title> <meta http-equiv="content-type" content="text/html; charset=utf8"> <style type="text/css"> #menu ul { list-style: none; } </style> </head> <body> <div id="menu" class="menu"> <a href="/" title="Nornix TreeMenu">start</a> <ul> …

Member Avatar for Atli
0
93
Member Avatar for tmv105

Hey. Perhaps your server has the [url=http://php.net/magic_quotes]magic_quotes[/url] feature enabled? If you don't know, create a PHP file that contains only: [icode]<?php phpinfo(); ?>[/icode] and look for [icode]magic_quotes_gpc[/icode]in the output it generates. If it is enabled, it will add extra slashes to quote-marks and back-slashes. A good way to nullify this …

Member Avatar for Atli
0
128
Member Avatar for pratik.itworld

Hey. By default, the size of a FLOAT is four bytes. (A single-precision floating-point value) If you specify a precision greater than 23, e.g. [icode]FLOAT(25)[/icode], it will be created as DOUBLE, and use eight bytes. (A double-precision floating-point value.) The default value for both, if none is specified, is 0. …

Member Avatar for Atli
0
89
Member Avatar for cwarn23

Hey. If you have a table with a VARCHAR field, you can often improve search performance on it by changing the field to the CHAR type. It has a static length, which allows MySQL to calculate a static row size for all the rows, rather then having to calculate a …

Member Avatar for mwasif
0
239
Member Avatar for muralibobby2015

Hey. You could also use the [url=http://php.net/substr_count]substr_count[/url] function. [code=php] if(substr_count($input, ',') == 2) { echo "Valid!;" } [/code]

Member Avatar for muralibobby2015
0
701
Member Avatar for SuntechWebsites

Hey. I wrote an article that explains in detail how you would upload a file into a MySQL database. ([url=http://bytes.com/topic/php/insights/740327-uploading-files-into-mysql-database-using-php]Linkage[/url]). In case you choose to go that route.

Member Avatar for Atli
0
205
Member Avatar for rajeesh_rsn

Hey. Consider this: [code=php] <?php /** * Obfuscates a word by replacing all but the first and the last letters with * * @param string $word The unscrabled word. * @return string */ function obfuscateWord($word) { $first = $word[0]; $last = $word[strlen($word)-1]; $middle = ""; for($i = 0; $i < …

Member Avatar for rajeesh_rsn
0
85
Member Avatar for edotman

Hey. To show the images, the general idea is: [code=php] <?php $dbLink = new mysqli('localhost', 'usr', 'pwd', 'dbName'); if(mysqli_connect_errno()) { die('Failed to connect to MySQL: ' . mysqli_connect_error()); } $sql = "SELECT `image_path`, `image_name` FROM `images`"; $result = $dbLink->query($sql); if($result) { while($row = $result->fetch_assoc()) { echo "<img src='{$row['image_path']}' alt='{$row['image_name']}' /><br>"; …

Member Avatar for Atli
0
176
Member Avatar for jppr03

Hey. What data are you looking to export? Fetching data from a form and writing it to a file is fairly simple. We just have no idea what sort of data you are using, and without knowing that we can't really say anything for certain. We need to see your …

Member Avatar for jppr03
0
2K
Member Avatar for Venom Rush

[QUOTE=Venom Rush;1038940]Is there a character set I can use that will accept any character no matter what language it is (with the exception of non-English looking characters like chinese characters for instance)[/QUOTE] UTF-8 (utf8_general_ci) should work fine for that. Even for the Chinese characters. I've created blog software in the …

Member Avatar for Venom Rush
0
192
Member Avatar for mahakaal

Hey. HTML: [code=html] <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf8"> </head> <body /> </html> [/code] MySQL [code=mysql] -- When creating a table: CREATE TABLE `myTable`( -- <insert fields> )DEFAULT CHARSET=utf8; -- Before querying the database. -- Note, this is usually not needed, but can be. SET NAMES 'utf8'; [/code] …

Member Avatar for venkat0904
0
256
Member Avatar for Vikk

Hey. Try something like: [code=php] <?php $dbLink = new mysqli('host', 'user', 'pwd', 'db'); $result = $dbLink->query("... Put your query here ..."); if($result) { $data = array(); // Loop through all the returned rows and group the values // into the $data array based on the 'col2' field. while($row = $result->fetch_assoc($result) …

Member Avatar for Vikk
0
136
Member Avatar for phouse512

Hey. What do you mean by "a message system"? Like a blog, or like a messenger? If it's a blog, there are probably hundreds of codes available online for you to choose from. [url=http://www.wordpress.org]Wordpress[/url] being something of a leader among them. If you mean a messenger system, then PHP alone …

Member Avatar for SKANK!!!!!
-1
140
Member Avatar for ezb

Hey. Be careful if you do this in a SQL query tho. Some MySQL servers use plain-text query logs, so while your passwords might be encrypted in the database itself, they would be stored in their original form in the logs. See [url=http://dev.mysql.com/doc/refman/5.0/en/query-log.html]these[/url] [url=http://dev.mysql.com/doc/refman/5.0/en/binary-log.html]two[/url] pages in the manual for details …

Member Avatar for digital-ether
0
762
Member Avatar for Stefano Mtangoo

Hey. I would recommend trying to keep logic classes clear of output. One of the fundamental ideas behind OOP is code re-usability, and by infusing the front-end code into the logic you are limiting the uses of the class to a single front-end. What if, down the line, you need …

Member Avatar for Stefano Mtangoo
0
444
Member Avatar for imhunk

Hey. Are you looking for a way to upload your PHP scripts on to the server, or are you looking for a way for you PHP scripts to receive file uploads from your users? If it is the former, you will need some sort of access to the server's hard …

Member Avatar for Atli
0
107
Member Avatar for ahmksssv

Hey. You only have very limited control over stuff like this, which is how it should be. Your code should not be able to mess up user-chosen browser settings, like the ability to see the menu bar. Users generally don't appreciate when websites mess up their browser ;-) Buuut. If …

Member Avatar for Atli
0
991
Member Avatar for honos1

Hey. When you create an array of <input> elements, you can specify the ID that is supposed to be used for that specific element. For example: [code=php] <?php echo "<form action='process.php' method='post'>"; for($i = 0; $i < 10; $i++) { echo "<input type='checkbox' name='box[$i]' value='$i'> Box #$i<br>"; } echo "<input …

Member Avatar for honos1
0
847
Member Avatar for Alba Ra

Hey. [QUOTE=Alba Ra;1037165]Basically the script does just what I've been asking it to do, except that the French accents (like in [I]thé[/I] or [I]café[/I]) don't appear (there's this rectangle instead).[/quote] Do you set the charset for the resulting page? By default, most browsers use the ISO charset, so if you …

Member Avatar for Alba Ra
0
1K

The End.