-
Posts
522 -
Joined
-
Last visited
Everything posted by budimir
-
OK, I think I'm getting an idea. Thnx.
-
Hey guys, I need some help with the export to CSV. I need to export only some fields from the DB to CSV. Some of those fields I need to limit to 35 chaaracters, change number format from 1,234.00 to 1234. I now how to export to CSV, but I need help with adjusting the result. Can you help me with that???
-
Well, try Google for "MySQL number of connections" and you will see what happens when you get "Too much connections" error. There is a reason why the connection should be closed!
-
You are not executing your sql query! Try: $exec = mysql_query($sql) or die (mysql_error());
-
Yes, you can use it! Read how to use odbc driver with ms access. You can use commands with odbc connector like: odbc_connect (establish a conection); odbc_execute (execute a query) etc etc....
-
Can anyone look at this script and tell me what is wrong here. The chart isn't showing any data. My eyes hurt from looking at it, and I still can't find the problem. <?php $db_server = "localhost"; $db_baza = "husqvarn_web"; $db_user = "*****"; $db_pass= "*******"; $veza = mysql_connect($db_server,$db_user, $db_pass) or DIE('Nisam se uspio spojiti na server'); $veza_baza = mysql_select_db($db_baza,$veza) or DIE('Nisam uspio odabrati bazu'); $data = array(); $upit = "SELECT user_id,COUNT(*) as puno FROM narudba GROUP BY user_id"; $rezultat = mysql_query($upit, $veza); $broj = mysql_num_rows($rezultat); while ($row = mysql_fetch_array($rezultat)){ while(list($key,$val) = each($row)){ if (is_int($key)) continue; $GLOBALS[$key] = $val; } $data[] = $puno; } // Kraj kupljenja broja narudžbi $upit2 = "SELECT * FROM users WHERE id = '$user_id'"; $rezultat2 = mysql_query($upit2,$veza); $broj2 = mysql_num_rows($rezultat2); while ($row2 = mysql_fetch_array($rezultat2)){ while(list($key,$val) = each($row2)){ if (is_int($key)) continue; $GLOBALS[$key] = $val; } //$data[] = $username; } print_r($data); //Kraj kupljenja imena ljudi koji su naručivali include_once( 'ofc-library/open-flash-chart.php' ); $bar = new bar_outline( 50, '#9933CC', '#8010A0' ); $bar->key( 'Broj narudzbi', 10 ); for( $i=0; $i<$broj; $i++ ) { $bar->data[] = $data; } print_r($bar); $g = new graph(); $g->title( 'Internet narucivanje'." ". date("Y"), '{font-size: 20px;}' ); // // BAR CHART: // //$g->set_data( $data ); //$g->bar_filled( 50, '#9933CC', '#8010A0', 'Broj narudzbi', 10 ); // // ------------------------ // $g->data_sets[] = $bar; // // X axis tweeks: // $g->set_x_labels( array( 'Diler1','Diler2','Diler3', 'Diler4', 'Diler5', 'Diler6' ) ); // // set the X axis to show every 2nd label: // $g->set_x_label_style( 10, '#9933CC', 0, 1 ); // // and tick every second value: // $g->set_x_axis_steps( 1 ); // $g->set_y_max( 100 ); $g->y_label_steps( 4 ); $g->set_y_legend( 'Broj narudzbi', 12, '#736AFF' ); echo $g->render(); ?>
-
Hey guys, I need a small help. How can I get a list of all logged in users??? And big question is how can I now that user is not active anymore, if he hasn't hit log-out button. Thanks.
-
If I understand you correctly, your site will be hosted on some server on ISP provider. In that case, I would say the username is NOT root, neither the password is blank. You will probably need to contact admin of these servers and ask for the username and password. Or, maybe you have recived these info when you have made an agreement with them.
-
If I understand correctly, you will need to select an ID of the row you want to display. So, for example, if you want to display row number 3 (out of 10). You will need to do a query like $sql = mysql_query("SELECT * FROM tblName WHRE id = '3'") or die (mysql_error()); This peace of code would display a row where ID = 3 (so, if prepared like I assume, it would be a row number 3). But, again, it's hard to understand what are you asking for.
-
Instead of localhost, try putting a name of your server where php is installed (http://server_name/location of script/) Good luck.
-
[SOLVED] Parse error: syntax error, unexpected T_VARIABLE
budimir replied to Thomisback's topic in PHP Coding Help
This is the problem in your query ... FROM $oc WHERE.... It needs to say ... FROM tablename WHERE.... -
You haven't specified where you are setting file types that can be uploaded. Right now you are letting everything through. Here is a piece of the code: if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 20000)) { if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } } else { echo "Invalid file"; }
-
How do you mean safer? What do you want to achieve? Give me some more details about what are you doing!
-
You can put html page in header it will do the redirect. header ("Location: your_page.php"); header ("Location: your_page.html"); It will work.
-
You can either use include function! Also, if you are worried about the number of connections on your database, you can close the connection after you have finished your query!
-
You can always put in your php script a line of code which would redirect to wanted page: header("Location: your_wanted_file.php"); You put it in the end of the file, and after all the code is executed it will show the page specified in the line above.
-
Where do you redirect after POST?
-
You have loads of good tutorials on the web about the login systems. You got a very nice one here, on phpfreaks, try to search for them. Everything is perfectly explaind. You got a lot of them with admin pages. Enjoy.
-
If you want us to check if there is any errors in your code, you need to gives your include files!!! Why are you using lon and short php tags? Did you enable short tags? Can't you just start your script and see if you get any errors? What do we need to check?
-
Hi there, You need to click on WAMP icon. Open Alias, click on phpmyadmin alias. On the bottom where it says "deny all" you need to put "allow all" (or you can put IP's which you want to allow). The security on new WAMP is pretty high, this is the reson why it's setup like that. Also you need to put your Apache server ONline. Regards.
-
On the top or in the bottom. "TOPIC SOLVED" click on it.
-
On your insert.php page put this: echo "Look, now it's not an empty page!"; You are not outputting any data on your insert.php page, neither you are redirecting that page. It's normal that it's blank!!!
-
Try this <?php // Execute the query to retrieve articles $result = $connector->query('SELECT * FROM cmshome'); $row = $connector->fetchArray($result); // Check whether a form has been submitted. If so, carry on if ($HTTP_POST_VARS){ // IMPORTANT!! ADD FORM VALIDATION CODE HERE // Update db - need to validate so can't send blank $main_txt = (addslashes($_POST['main_txt'])); $updateQuery = "UPDATE cmshome SET main_txt='$main_txt'"; // Save the form data into the database if ($result = $connector->query($updateQuery)){ // It worked, give confirmation echo "<center><b>Main Page Updated</b></center><br>"; }else{ // It hasn't worked so stop. Better error handling code would be good here! exit("<center>Sorry, there was an error saving to the database</center>"); } } ?>
-
This one! Microsoft Access Driver (*.mdb)