- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 207
- Posts with Upvotes
- 179
- Upvoting Members
- 96
- Downvotes Received
- 54
- Posts with Downvotes
- 53
- Downvoting Members
- 8
I am high on life !
- Interests
- Computers, music, playing with hitler(my "german" shepherd dog), cooking, long drives,…
- PC Specs
- I have a crappy computer.
Re: hmm.. AFAIK, only mysql uses port 3306. To check what ports are being used, open command prompt and type netstat -ab. It ll list all the applications and the ports used by those applications. Maybe that port is blocked by your firewall ? | |
Re: @vipin_php, Next time, please put your code in [code=php ] [/code ] tags. | |
Re: [code=php] <?php $arr=array(); for($i=0;$i<7;$i++){ $arr[$i]="./img/images/".$i.".jpg"; //assigning the image location to the array $arr. } $random=rand(0,6); //generating a random number echo "<img src=".$arr[$random].">"; //printing the image ?> [/code] Thats it :) | |
Re: When the user logs in, check if its a valid login. If, yes, then query the table which has the user details for this username. Since this is a login script, username has to be unique. So, a username can have only 1 row of details. [code=php] <?php //connection //get … | |
Re: [code=php] <?php $filename ="excelreport.xls"; $contents = "testdata1 \t testdata2 \t testdata3 \t \n"; header('Content-type: application/ms-excel'); header('Content-Disposition: attachment; filename='.$filename); echo $contents; ?> [/code] This is the simplest way to generate an excel report. | |
Re: This simply wouldn't work because this is how your source would look like. [code] <input type= "text" name ="ch1" disabled='true' disabled='false'/> [/code] | |
Re: [code=php] <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="forum"; // Database name $tbl_name="test_mysql"; // Table name // Connect to server and select databse. mysql_connect($host, $username, $password)or die("cannot connect"); mysql_select_db($db_name)or die("cannot select DB"); $sql="SELECT * FROM test_mysql"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> … | |
Re: The problem is, [quote]if((!empty($_FILES["car_info_file"])) && ($_FILES['car_info_file']['error'] == [/quote] and all will not be accessible inside the function. Instead, pass $_FILES as parameter for the function. [code=php] upload_files($_FILES); [/code] Then you can access it in your function like, $fil['car_info_file']['name'] and so on.. Btw, type is application/xls.. | |
Re: [quote] Please Bang dani Help me asap, i'll say thank' you and thanks Salam Open Source, please cc to my email <EMAIL SNIPPED> thx [/quote] :-O What the .... | |
Re: Yep. If its a csv file, then you can make use of [url=http://nl3.php.net/manual/en/function.fgetcsv.php] fgetcsv [/url] to do the required operation. | |
Re: [quote](Incidentally, if you get the time, what exactly is the recommended code doing?) [/quote] [icode] ob_start() [/icode]. Its turning on the output buffer. So any output is kept in the buffer. And [icode]ob_flush() [/icode] is to flush the buffer :) | |
Re: If you want to count the number of records in the table, you can use mysql_num_rows. [code=php] $query = "select * from tablename"; $result = mysql_query($query); echo mysql_num_rows($result)." records found..."; [/code] If you want the number of columns in a particular table, [code=php] $query = "show columns from tablename"; $result … | |
Re: [code=php] <?php $file="test.xls"; $test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>"; header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=$file"); echo $test; ?> [/code] This works. | |
Re: [url]http://davidwalsh.name/backup-mysql-database-php[/url] A good script to backup the whole database or just a few selected tables. Note: While generating the backup file, he uses the command drop tablename. You better ignore (comment) that line :) Edit: I somehow missed 'excel' in your post. This takes the backup on a .txt file … | |
Re: If you want current date and time to insert to a table, you can use now() function of mysql. [url]http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_now[/url] | |
Re: [QUOTE=duttydea;626807] How can i add the data from the array to a Mysql table?[/QUOTE] If you have a multidimensional array (or even a normal array), you should go through each and every element of the array (iterate it) and then insert the value to the table. For example, [code=php] $array … | |
Re: [code=php]<?php if(isset($_POST['submit'])){ $name = $_POST['name']; $age = $_POST['age']; //insert into table } ?> <html> <body> <form name="test" method="post" action="samepage.php"> Name: <INPUT TYPE="text" NAME="name" value="<?php echo $name ?>"><br /> Age: <input type="text" name="age" value="<?php echo $age ?>"><br /> <INPUT TYPE="submit" name="submit" value="submit"> </form> </body> </html>[/code] This is just an example program. … | |
Re: I have not checked your query. But this will work. [code=php] $query="select * from table where date_column between "2001-01-05" and "2001-01-10";[/code] This will print all the records where the date_column value lies between the first date and the second date. | |
Re: Order by multiple columns work this way. For example, you have 4 records. [quote] field1 | field2 | field3 | field4 -------+-------+--------+---------- 1 | 1 | 2 | 4 ------------------------------------- 2 | 2 | 100 | 5 ------------------------------------- 3 | 2 | 1 | 3 ------------------------------------- 4 | 3 | … | |
Re: Huh.. Can you post your code ? (because I have never heard of this problem before!) | |
Re: [code=php] <?php $filename ="excelreport.csv"; $contents = "testdata1;testdata2;testdata3; \n"; header('Content-type: application/ms-excel'); header('Content-Disposition: attachment; filename='.$filename); echo $contents; ?> [/code] I had given a similar example in another thread. Well, csv or excel, the procedure is the same. | |
Re: maybe you should check previous posts. But anyway, when you submit a form(for example,form1.php), post all the variables to another page(form2.php), add those variables to another variable, say $message and use mail function to send the mail. More on mail function [url=http://in2.php.net/manual/en/function.mail.php]Here[/url]. | |
Re: [quote] $_FILES['uploadedfile']['name'] [/quote] Shouldn't this be $_FILES['photo']['name'] :) | |
Re: $user_id=$_POST['UserID']; $password=$_POST['Password']; $query="select * from Customer where UserID = '$user_id' and Password = '$password'"; echo $query; $result=mysql_query($query) or die(mysql_error()); Check what $query prints. Execute the same in phpmyadmin. oh, and please, next time you post your code, put it in [code] tags. | |
Re: Pretty simple. Fetch the data from the database and place it between <textarea> tags. Here is an example. [code=php] <?php if(isset($_POST['save'])) { print "<pre>"; print_r($_POST); print "</pre>"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Full featured example</title> <!-- TinyMCE --> <script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> <script … | |
Re: Umm.. you are passing the id as a parameter. Why are you trying to assign the value of $id to t (in javascript function) ? [code=php] <html> <head> <SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"> <!-- function login(t) { alert(t); } --> </SCRIPT> </head> <body> <?php $id=$_GET['id']; print "<input type='button' name='button' value='button' onClick=login('$id')>"; ?> … |