[PHP] PHP Job in Curitiba, Brasil
Hi list We here at ZeroCinco Propaganda are looking for a PHP Developer to assist me in our web projects Must have a good knoledge of PHP and mySQL, and integration with ActionScript. Also you need to be confortable using Photoshop. If you are interested send your resume to [EMAIL PROTECTED] and mention you found the ad on this list, because that will be a bonus to you. Eu represento a ZeroCinco Propaganda e nos estamos procurando um webdeveloper com experiência em PHP, mySQL e ActionScript, que se sinta confortavel no Photoshop. Para se candidatar à vaga é preciso enviar o currículo para o E-mail [EMAIL PROTECTED] Thanks/Obrigado -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] From TXT to a mySQL db
This looks good, but since the db server is in a hosting company it will be possible to read from a .txt ? also I have never seen the LOAD DATA command, so I'm testing here and having problems ... can anyone spot what's wrong on this query ? $SQL = "LOAD DATA INFILE 'test.txt' INTO TABLE test FIELDS TERMINATED BY '^' LINES STARTING BY '20'"; $Query = mysql_query($SQL); TIA Marcelo Wolfgang Jason Pruim wrote: On Oct 18, 2007, at 2:29 PM, Marcelo Wolfgang wrote: Hi all, I need some helps/tips to know if a transition from a txt file to a sql database is viable to do. I have a TXT file that has lots of records like this: 10^13150^COMERCIO DE CALCADOS DILEU LTDA^COMERCIO DE CALCADOS DILEU LTDA^RUA JOSE BONIFACIO, 329^CENTRO^IJUI^RS^9870^055 3325409^ 10^13169^ZILMAR DE PARIS^ZILMAR DE PARIS^MARECHAL FLORIANO1151^CENTRO^SOLEDADE^RS^9930^ 54 3812166^ 20^9833^90700^ELLA VERAO 2007^90702^COURO SOFT^BCO 20^9833^90700^ELLA VERAO 2007^90702^COURO SOFT^PRETO The rows that start with 10 are one kind of data and the rows that start with 20 are another kind of data, each will go to its own table (there's a lots of 10's and lots of 20's). The first set of data, the ones that start with 10 its table structure will look like this (the 10 will be discarded): id - number name - text altName - text address - text neighbour - text city - text state - text cep - number tel - text mail - text the second one with the rows that start with 20 its structure will be like this ( again the 20 will be discarded ) idClient - number brand - text idLine - number descLine - text ref -number material - text color - text Is there a quick and simple way to convert the row string into a INSERT query ? Should I try some manipulation first with the TXT file ? I think what you are looking for is the "LOAD DATA" command. With that one of the options is "SEPARATED BY" I'd do a search for "LOAD DATA" in the mysql site. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] From TXT to a mySQL db
Hi all, I need some helps/tips to know if a transition from a txt file to a sql database is viable to do. I have a TXT file that has lots of records like this: 10^13150^COMERCIO DE CALCADOS DILEU LTDA^COMERCIO DE CALCADOS DILEU LTDA^RUA JOSE BONIFACIO, 329^CENTRO^IJUI^RS^9870^055 3325409^ 10^13169^ZILMAR DE PARIS^ZILMAR DE PARIS^MARECHAL FLORIANO1151^CENTRO^SOLEDADE^RS^9930^ 54 3812166^ 20^9833^90700^ELLA VERAO 2007^90702^COURO SOFT^BCO 20^9833^90700^ELLA VERAO 2007^90702^COURO SOFT^PRETO The rows that start with 10 are one kind of data and the rows that start with 20 are another kind of data, each will go to its own table (there's a lots of 10's and lots of 20's). The first set of data, the ones that start with 10 its table structure will look like this (the 10 will be discarded): id - number name - text altName - text address - text neighbour - text city - text state - text cep - number tel - text mail - text the second one with the rows that start with 20 its structure will be like this ( again the 20 will be discarded ) idClient - number brand - text idLine - number descLine - text ref -number material - text color - text Is there a quick and simple way to convert the row string into a INSERT query ? Should I try some manipulation first with the TXT file ? TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best technique to get the ID of the last inserted value
Hi all, I'm a newbie in PHP, and I want to know what's the best technique you guys use when you need to get the id of the last inserted value in the database. My first thought is to do a SELECT on the db and get the last id, but I know that if I have two almost simultaneous connections I may get the wrong one, so that's the why of my question. TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Selecting a special row from the database
Wow, Thanks for all the ideas, I'll explore all of them. I have the content people messing with the adm so it's hard to try things I don't fully understand by now About the sql injection, the db user I set for this has only select privileges, should I be worried even with this ? Thanks again for the replies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Selecting a special row from the database
Hi all, I'm building a news display page for a website, and since the user has 2 ways to arrive there, I want to know if this is possible: 1) the user arrive at news.php I will run a query at the db, and get the latest news to be the main one (full display) and display the others news in a list 2) the user arrived from a link to a specific news to news.php?id=10 It should display the news with id = 10 as the main news and get the latest ones to display in a list of other news I've so far was able to add a dinamic WHERE to my query ( if I have or not the id GET parameter ) and if I don't have it, I'm able to display the latest result as the main news, but when I have an id as a GET parameter, I have a where clause in my query and it will return only the main news and not build up the news list what I want is to separate the news that the user want to see ( the id=XX one ) from the others rows, can someone advice me ? Here is the code I have so far, I hope it serve as a better explanation than mine! TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File uploading and saving info on mysql
Richard Lynch wrote: Browsers will probably NOT populate these reliably... Mac Safari, might, for example, choose "application/x-pdf" for the PDF file. You really can't rely on 'type' to be useful in any way, shape, or form. Thanks for the tips, I've deleted this check, and changed how I check for the file type in the code. and I've redone the code to match Jim Lucas suggestion also, it's working very nicely right now. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File uploading and saving info on mysql
Hi all, I'm developing for my first time an upload file form which will populate a sql insert query, I think I got everything working fine, but the data isn't been saved on the database. Can someone help me with what I'm doing wrong here ? the code follow: 0) { echo "Return Code: " . $_FILES["file"]["error"] . ""; } else { if (file_exists("../downloads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../downloads/" . $_FILES["file"]["name"]); } } } else { echo "Invalid file"; } $title = $_POST["title"]; $filePath = "../downloads/" . $_FILES["file"]["name"]; if($_FILES["file"]["type"] == "application/pdf"){ $fileType = "pdf"; } else if ($_FILES["file"]["type"] == "application/msword"){ $fileType = "doc"; } echo($title) . ""; //outputs 'yada' ( correctly as I've typed on the form; echo($filePath) . ""; //outputs '../downloads/66321-Estrutura.doc' and I can check that the file is there; echo($fileType) . ""; //outputs 'doc' this is correct; mysql_connect("localhost",$db_user,$db_pass) or die (mysql_error());; mysql_select_db ($db_table); $user_Query = mysql_query("INSERT INTO tb_downloads (var_title, var_filepath, var_filetype, dt_data, bol_active) VALUES ('$title', '$filePath','$fileType','NOW(),1)"); mysql_close(); echo($user_Query) . ""; //outputs nothing (? I suck at debugin queries) header("Location: http://www.w3ol.com.br/50congresso/adm/downloads.php";); // I know that this won't work while I echo something on the page, but the echo is there for debug only ?> TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
and what if $_GET['id'] is something like "1; DROP TABLE tb_emails;" ?? SQL injection just waits to happen Something I just thought, he could do a drop table inside an update statement ? because the query is : UPDATE tb_emails SET bol_active = $action WHERE auto_id = $id so if he changed the $action or the $id, it will be inside the UPDATE, doesn't changing any of the variables to a DROP TABLE just give an error ? TIA Marcelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
and what if $_GET['id'] is something like "1; DROP TABLE tb_emails;" ?? SQL injection just waits to happen I think tha tit will be too much of a hacker effort just to kill a table of contact emails, and also he will have to guess ( is there other way ? ) the table name, but just to be on a safer side: - Is there a way to say that id can only be a number ? something like $id:Number = $_GET['id']? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] UPDATE and redirect
Hi, It's fixed, I think the problem where at the '==' ... I have to remember that in PHP this is like ActionScript. Also, what if $_GET['act'] is neither 'a' or 'd'? Again, what if $_GET['id'] is null? The only way to not be 'a' or 'd' or to be null is if someone mess with url, which should throw an error anyway and not run the query. The link that get me to this page where the code is executed is generated to have these options. Thanks for the reply's -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] UPDATE and redirect
Hi all, I'm new to this list and new to php programming so sorry if I do something wrong here :) Ok, now to my problem. I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's wrong here. My code follows : $email_Query = mysql_query("UPDATE 'tb_emails' SET 'bol_active' = $action WHERE `auto_id` = $id"); mysql_close(); ?> The page is executed, but it don't update the table ... I've tried with the '' and without it ( the phpmyadmin page is where I got the idea of using the '' ). Any clues ? Also, how can I make a redirect after the query has run ? TIA Marcelo Wolfgang -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php