altariamx2003
asked on
Why the record on my database is incomplete??????
First of all
Thanks for all your help, you guys are incredible and a huge help for me.
Im doing the administrative section to add new articles for the news section for http://www.itssc.edu.mx.
In this this page (the administrative) the user can add new articles with a main photo and if he wants a gallery also.
The administrative part for http://www.itssc.edu.mx is located in the local server (localhost), let me explain why is there and not in the remote server.
Sometimes the user wants to add a gallery to the article, to avoid the problem of the size of the images, I dedice to storage this part in localhost to resize the images for the gallery to smallest sizes and after that send them by ftp to my remote server.
And here is the problem, after the last image is send to our remote server by ftp I connect the remote database (In the same page) to add the new article but when I check if the information of the article was successfully saved in my database the data are incomplete.
I would like to know why everytime that I want to add a new article to my database the information is saved but incomplete.
I made a little example about this problem
I hope you can help me.
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
1.- In this link you can see the information to upload. http://www.itssc.edu.mx/information-to-upload.jpg
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
2.- In this link you can see the information saved in our database. http://www.itssc.edu.mx/information-saved-on-database.jpg
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
3.- In this link you can see the estructure of my database. http://www.itssc.edu.mx/database-estructure.jpg
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Also I you need in this two last link are the phpcode and the form that I use for this page
http://www.itssc.edu.mx/form.txt
http://www.itssc.edu.mx/phpcode.txt
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Thanks for all your help, you guys are incredible and a huge help for me.
Im doing the administrative section to add new articles for the news section for http://www.itssc.edu.mx.
In this this page (the administrative) the user can add new articles with a main photo and if he wants a gallery also.
The administrative part for http://www.itssc.edu.mx is located in the local server (localhost), let me explain why is there and not in the remote server.
Sometimes the user wants to add a gallery to the article, to avoid the problem of the size of the images, I dedice to storage this part in localhost to resize the images for the gallery to smallest sizes and after that send them by ftp to my remote server.
And here is the problem, after the last image is send to our remote server by ftp I connect the remote database (In the same page) to add the new article but when I check if the information of the article was successfully saved in my database the data are incomplete.
I would like to know why everytime that I want to add a new article to my database the information is saved but incomplete.
I made a little example about this problem
I hope you can help me.
--------------------------
1.- In this link you can see the information to upload. http://www.itssc.edu.mx/information-to-upload.jpg
--------------------------
2.- In this link you can see the information saved in our database. http://www.itssc.edu.mx/information-saved-on-database.jpg
--------------------------
3.- In this link you can see the estructure of my database. http://www.itssc.edu.mx/database-estructure.jpg
--------------------------
Also I you need in this two last link are the phpcode and the form that I use for this page
http://www.itssc.edu.mx/form.txt
http://www.itssc.edu.mx/phpcode.txt
--------------------------
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
maybe the tool that you use to view data is not showing properly... do you have any other tool to browse the database? can you update the record from the tool that you are using? put the same values and update from tool and see the data from your page...
ASKER
This is how it look the information after that I update it using phpmyadmin: http://www.itssc.edu.mx/noticias/detalle.php?recordID=471101254
In this link you can see the information upated on phpmyadmin: http://www.itssc.edu.mx/information-saved-on-database2.jpg
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
let me show you the data of other article storage using the same code but with the page located on http://www.itssc.edu.mx
this is the information on my database using phpmyadmin (provided by hostgator): http://www.itssc.edu.mx/information-saved-on-database1.jpg. As you can see the problem is not my phpadmin because this new record was storaged ok.
And this is how this new record look in the news section of itssc.edu.mx: http://www.itssc.edu.mx/noticias/detalle.php?recordID=8
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
In this link you can see the information upated on phpmyadmin: http://www.itssc.edu.mx/information-saved-on-database2.jpg
--------------------------
let me show you the data of other article storage using the same code but with the page located on http://www.itssc.edu.mx
this is the information on my database using phpmyadmin (provided by hostgator): http://www.itssc.edu.mx/information-saved-on-database1.jpg. As you can see the problem is not my phpadmin because this new record was storaged ok.
And this is how this new record look in the news section of itssc.edu.mx: http://www.itssc.edu.mx/noticias/detalle.php?recordID=8
--------------------------
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
can you please post the value of $insertSQL before these lines
>>>> print the value of $insertSQL somehow at this point with a sample data
mysql_select_db($database_ dbnotes, $dbnotes);
$Result1 = mysql_query($insertSQL, $dbnotes) or die(mysql_error());
so we can see what is wrong...
>>>> print the value of $insertSQL somehow at this point with a sample data
mysql_select_db($database_
$Result1 = mysql_query($insertSQL, $dbnotes) or die(mysql_error());
so we can see what is wrong...
also remove confidential data from http://www.itssc.edu.mx/phpcode.txt ;) like dbname pw login etc...
ASKER
this is the result:
INSERT INTO noticias (clave, titulo, fecha, lugar, resumen, cuerpo, foto, galeria) VALUES ('471101425', 'Arturo Chávez defiende figura del arraigo', '2010-08-19', 'ciudad de mexico', 'El procurador Arturo Chávez asegura que este instrumento legal con mucha frecuencia da mayor eficacia al trabajo de la dependencia', 'El procurador Arturo Chávez Chávez defendió la figura del arraigo y los testigos protegidos ante las criticas de Carlos Navarrete (PRD) presidente del Senado.\r\n\r\nDurante los Diálogos por la Seguridad, encabezados por el presidente Felipe Calderón, en el Campo Militar Marte, el legislador cuestionó el abuso y a utilización equivocada de estos instrumentos legales.\r\n\r\nEl titular de la Procuraduría General de la República (PGR) dijo que la figura del arraigo con mucha frecuencia da mayor eficacia al trabajo de esta dependencia.\r\n\r\nDijo que del total de arraigos obtenidos por la PGR, el 90% es consignado ante un juez. De ellos, al 90% se le libra orden de aprehensión, y de esta cifra, al menos al 90% le es dictado auto de formal prisión.\r\n\r\nSin embargo, cuando Navarrete le preguntó que a final cuántas resultan sentenciadas, el procurador admitió no tener la cifra, además de que hay caso a que todavía están en litigio en tribunales. ', 'IMG_6731.JPG', '0')
INSERT INTO noticias (clave, titulo, fecha, lugar, resumen, cuerpo, foto, galeria) VALUES ('471101425', 'Arturo Chávez defiende figura del arraigo', '2010-08-19', 'ciudad de mexico', 'El procurador Arturo Chávez asegura que este instrumento legal con mucha frecuencia da mayor eficacia al trabajo de la dependencia', 'El procurador Arturo Chávez Chávez defendió la figura del arraigo y los testigos protegidos ante las criticas de Carlos Navarrete (PRD) presidente del Senado.\r\n\r\nDurante los Diálogos por la Seguridad, encabezados por el presidente Felipe Calderón, en el Campo Militar Marte, el legislador cuestionó el abuso y a utilización equivocada de estos instrumentos legales.\r\n\r\nEl titular de la Procuraduría General de la República (PGR) dijo que la figura del arraigo con mucha frecuencia da mayor eficacia al trabajo de esta dependencia.\r\n\r\nDijo que del total de arraigos obtenidos por la PGR, el 90% es consignado ante un juez. De ellos, al 90% se le libra orden de aprehensión, y de esta cifra, al menos al 90% le es dictado auto de formal prisión.\r\n\r\nSin embargo, cuando Navarrete le preguntó que a final cuántas resultan sentenciadas, el procurador admitió no tener la cifra, además de que hay caso a que todavía están en litigio en tribunales. ', 'IMG_6731.JPG', '0')
just a hunch... but are you setting the CHARACTER SET to latin1_spanish ?.. because the data is being truncated whenever it hits one of those characters
so no issue with query ;) good... so problem should be character sets... do you have any other tool to run this query and see if it is stored in db correctly?
INSERT INTO noticias (clave, titulo, fecha, lugar, resumen, cuerpo, foto, galeria)
VALUES (
'471101425',
'Arturo Chávez defiende figura del arraigo',
'2010-08-19',
'ciudad de mexico',
'El procurador Arturo Chávez asegura que este instrumento legal con mucha frecuencia da mayor eficacia al trabajo de la dependencia',
'El procurador Arturo Chávez Chávez defendió la figura del arraigo y los testigos protegidos ante las criticas de Carlos Navarrete (PRD) presidente del Senado.\r\n\r\nDurante los Diálogos por la Seguridad, encabezados por el presidente Felipe Calderón, en el Campo Militar Marte, el legislador cuestionó el abuso y a utilización equivocada de estos instrumentos legales.\r\n\r\nEl titular de la Procuraduría General de la República (PGR) dijo que la figura del arraigo con mucha frecuencia da mayor eficacia al trabajo de esta dependencia.\r\n\r\nDijo que del total de arraigos obtenidos por la PGR, el 90% es consignado ante un juez. De ellos, al 90% se le libra orden de aprehensión, y de esta cifra, al menos al 90% le es dictado auto de formal prisión.\r\n\r\nSin embargo, cuando Navarrete le preguntó que a final cuántas resultan sentenciadas, el procurador admitió no tener la cifra, además de que hay caso a que todavía están en litigio en tribunales. ',
'IMG_6731.JPG',
'0'
)
can you please post the screen for this data (mysql), so we can have a clear picture of whats happening here...
also remove any confidential data for
$ftpuser = "xxx";
$ftppass = "xxxxxxx";
$ftppath = "xxxxxxxxxxxxxxxx";
$ftpuser = "xxx";
$ftppass = "xxxxxxx";
$ftppath = "xxxxxxxxxxxxxxxx";
ASKER
ok
this is the new example:
information to upload: http://www.itssc.edu.mx/information-to-upload1.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database2.jpg
if you enter to itssc.edu.mx the article looks incomplete: http://www.itssc.edu.mx/noticias/detalle.php?recordID=471101430
this is the new example:
information to upload: http://www.itssc.edu.mx/information-to-upload1.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database2.jpg
if you enter to itssc.edu.mx the article looks incomplete: http://www.itssc.edu.mx/noticias/detalle.php?recordID=471101430
ASKER
sorry this is the link for the information saved on database: http://www.itssc.edu.mx/information-saved-on-database3.jpg
ASKER
I think that is not the CHARACTER SET, I save the page directly on itssc.edu.mx and generate a new record
and this is the result:
link for the information saved on the database: http://www.itssc.edu.mx/information-saved-on-database4.jpg
link to see the article on itssc.edu.mx: http://www.itssc.edu.mx/noticias/detalle.php?recordID=1
and this is the result:
link for the information saved on the database: http://www.itssc.edu.mx/information-saved-on-database4.jpg
link to see the article on itssc.edu.mx: http://www.itssc.edu.mx/noticias/detalle.php?recordID=1
so you say, if you save data correctly, it will display correctly.
and the tool to insert /update record directly is working fine...
then the only issue is my_sql is cutting the values when inserting into table
is this correct? when I say character set, I mean when you connect to mySQL, maybe there is a setting to say "I will work with spanish" so it can handle special characters properly...
and the tool to insert /update record directly is working fine...
then the only issue is my_sql is cutting the values when inserting into table
is this correct? when I say character set, I mean when you connect to mySQL, maybe there is a setting to say "I will work with spanish" so it can handle special characters properly...
one more test... instead of spanish character, can you please add just plain english like this one
This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!..
and see if it is stored correctly.
This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!.. This is a plain text!..
and see if it is stored correctly.
check this
http://www.saiweb.co.uk/mysql/mysql-forcing-utf-8-compliance-for-all-connections
looks like you are using some old drivers or need to set something after connection is established...
http://www.saiweb.co.uk/mysql/mysql-forcing-utf-8-compliance-for-all-connections
looks like you are using some old drivers or need to set something after connection is established...
ASKER
Hi
I took this info from the new york times
information to upload: http://www.itssc.edu.mx/information-to-upload2.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database5.jpg
informaiton on itssc.edu.mx:http://www.itssc.edu.mx/information-on-itssc.jpg
I took this info from the new york times
information to upload: http://www.itssc.edu.mx/information-to-upload2.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database5.jpg
informaiton on itssc.edu.mx:http://www.itssc.edu.mx/information-on-itssc.jpg
ASKER
As you see on the information saved on the database the data from the ny times aritcle is also incomplete
can you please refer to my earlier post about the structure of the sql insert statement??
GetSQLValueString doesn't properly escape characters.. which is why your having this problem
GetSQLValueString doesn't properly escape characters.. which is why your having this problem
ASKER
ok
tiller
just let me change the sintax because if I add your code as you post it always show me errors
tiller
just let me change the sintax because if I add your code as you post it always show me errors
there doesn't appear to be any errors in the syntax... can you post what the error is that your getting?
ASKER
Hi tiller I change you a little bit your code and I made an example and this is the result:
information to upload: http://www.itssc.edu.mx/information-to-upload3.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database6.jpg
informaiton on itssc.edu.mx:http://www.itssc.edu.mx/information-on-itssc1.jpg
I took the data from the nytimes: http://www.nytimes.com/2010/05/20/science/earth/20noaa.html?_r=1&hp
information to upload: http://www.itssc.edu.mx/information-to-upload3.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database6.jpg
informaiton on itssc.edu.mx:http://www.itssc.edu.mx/information-on-itssc1.jpg
I took the data from the nytimes: http://www.nytimes.com/2010/05/20/science/earth/20noaa.html?_r=1&hp
$clave1 = mysql_real_escape_string($_POST['clave']);
$titulo1 = mysql_real_escape_string($_POST['titulo']);
$fecha1 = mysql_real_escape_string($_POST['fecha']);
$lugar1 = mysql_real_escape_string($_POST['lugar']);
$resumen1 = mysql_real_escape_string($_POST['resumen']);
$cuerpo1 = mysql_real_escape_string($_POST['cuerpo']);
$foto1 = mysql_real_escape_string($_POST['foto']);
$galeria1 = mysql_real_escape_string($_POST['galeria']);
$insertSQL = "INSERT INTO noticias (clave, titulo, fecha, lugar, resumen, cuerpo, foto, galeria) VALUES ('$clave1','$titulo1','$fecha1','$lugar1','$resumen1','$cuerpo1','$foto1','$galeria1')";
ASKER
this is the error that I have If I use your code just like that:
Parse error: parse error in C:\wamp\www\noticias\altas _test4.php on line 124
the line 124 is: $insertSQL = "INSERT INTO noticias (clave, titulo, fecha, lugar, resumen, cuerpo, foto, galeria) VALUES (".mysql_real_escape_strin g($_POST[' clave'])". , ".mysql_real_escape_string ($_POST['t itulo'])". , ".mysql_real_escape_string ($_POST['f echa'])"., ".mysql_real_escape_string ($_POST['l ugar'])"., ".mysql_real_escape_string ($_POST['r esumen'])" ., ".mysql_real_escape_string $_POST['cu erpo'])"., ".mysql_real_escape_string $_POST['fo to'])"., ".mysql_real_escape_string $_POST['ga leria'])". ")";
Parse error: parse error in C:\wamp\www\noticias\altas
the line 124 is: $insertSQL = "INSERT INTO noticias (clave, titulo, fecha, lugar, resumen, cuerpo, foto, galeria) VALUES (".mysql_real_escape_strin
so once you made those changes it worked?
ASKER
nop, the record isnt complete
this is the result of the example that I made using mysql_real_escape_string
information to upload: http://www.itssc.edu.mx/information-to-upload3.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database6.jpg
informaiton on itssc.edu.mx:http://www.itssc.edu.mx/information-on-itssc1.jpg
I took the data from the nytimes: http://www.nytimes.com/2010/05/20/science/earth/20noaa.html?_r=1&hp
this is the result of the example that I made using mysql_real_escape_string
information to upload: http://www.itssc.edu.mx/information-to-upload3.jpg
information saved on database: http://www.itssc.edu.mx/information-saved-on-database6.jpg
informaiton on itssc.edu.mx:http://www.itssc.edu.mx/information-on-itssc1.jpg
I took the data from the nytimes: http://www.nytimes.com/2010/05/20/science/earth/20noaa.html?_r=1&hp
I would check your mysql installation, maybe reinstall and reinstall the service, with the most current version because the php is setup correctly
ASKER
last night I reinstall php and mysql on my local server and the problem remains
ASKER
I test an alternative solution and it works!!!
I move the part when I connect the database and when I add the new article to a new php file, this new php file is located in itssc.edu.mx.
The php variables from the form in php file located in localhost I send them by POST using curl to the PHP file located in my remote server
I know this is not the best solution but at leat it works
I move the part when I connect the database and when I add the new article to a new php file, this new php file is located in itssc.edu.mx.
The php variables from the form in php file located in localhost I send them by POST using curl to the PHP file located in my remote server
I know this is not the best solution but at leat it works
ASKER
yes im sure that the data is not stored correctly.
In this link you can see what Im try to upload: http://www.itssc.edu.mx/information-to-upload.jpg
In this link you can see the information storaged in my db: http://www.itssc.edu.mx/information-saved-on-database.jpg, as you can see the information is incomplete.
look this is how you see in the news section on itssc.edu.mx: http://www.itssc.edu.mx/noticias/detalle.php?recordID=471101120
I think the code is Ok, because I upload the same page but on http://www.itssc.edu.mx not in localhost and the record was storage ok.
I remove the line that you suggest and nothing change the record is storage incomplete: http://www.itssc.edu.mx/noticias/detalle.php?recordID=471101254