trafficinsanity Posted November 1, 2007 Share Posted November 1, 2007 I need a solution here . I have only recently entered the world of php-mysql . My first project is coming along ok. Membership is already growing quickly. My problem : The site is a downline builder for traffic exchanges & safelist. The problem I am having is when url of a website in the database exceeds 50 characters no referer shows up. I originally used a query similar to this to create the table. <?php include "config.php"; $global_dbh = mysql_connect($dbhost, $dbusername, $dbpassword); mysql_select_db($dbname, $global_dbh); $queryone = "CREATE TABLE $dbsites ( SITE text NOT NULL, name text NOT NULL, description text NOT NULL, url text NOT NULL)"; $querytwo = "CREATE TABLE $dbuname ( SITE text NOT NULL, username text NOT NULL, uname text NOT NULL)"; $querytre = "CREATE TABLE $dbusers ( username text NOT NULL, password text NOT NULL, email text NOT NULL, referer text NOT NULL)"; $resultone = mysql_query($queryone, $global_dbh); $resulttwo = mysql_query($querytwo, $global_dbh); $resulttre = mysql_query($querytre, $global_dbh); ?> Done How can I make the urls work even with more than 50 characters ? Quote Link to comment https://forums.phpfreaks.com/topic/75623-character-fields-being-truncated/ Share on other sites More sharing options...
aschk Posted November 1, 2007 Share Posted November 1, 2007 I'm already horrendously depressed at seeing the liberal use of the TEXT datatype for EVERY field. Before continuing I would recommend on reading about database normalisation (google it), and also MySQL datatypes : http://dev.mysql.com/doc/refman/5.0/en/data-types.html Quote Link to comment https://forums.phpfreaks.com/topic/75623-character-fields-being-truncated/#findComment-382656 Share on other sites More sharing options...
trafficinsanity Posted November 1, 2007 Author Share Posted November 1, 2007 I thought I mentioned I am brand new to this . I guess I am in the wrong forum . I was up all nite reading everything i could find and my head is sort of spinning. I guess this is an experts only forum. WHY is there a help section here . experts really shouldn't need any help . I'm already horrendously depressed at seeing the liberal use of the TEXT datatype for EVERY field. Before continuing I would recommend on reading about database normalisation (google it), and also MySQL datatypes : http://dev.mysql.com/doc/refman/5.0/en/data-types.html Quote Link to comment https://forums.phpfreaks.com/topic/75623-character-fields-being-truncated/#findComment-382675 Share on other sites More sharing options...
fenway Posted November 1, 2007 Share Posted November 1, 2007 I guess this is an experts only forum. Entirely the opposite... I wish there were more experts ;-) Could you post your table structure (with SHOW CREATE TABLE) and the code that you use to get at and insert the url? You shouldn't have this issue. As for DB normalization and datatypes, it appears that are some improvements that can be made... but one thing at a time. Quote Link to comment https://forums.phpfreaks.com/topic/75623-character-fields-being-truncated/#findComment-382720 Share on other sites More sharing options...
aschk Posted November 1, 2007 Share Posted November 1, 2007 Apologies if that came across as a flame, it was supposed to be such. As fenway suggests, post your SHOW CREATE TABLE here along with some sample data, and your PHP code that you're using. In theory you should have no problem with inputting a string longer than 50 characters into a TEXT field type. As TEXT is an ever expanding field type. You should probably be using VARCHAR(<NUMBER>) instead, and UNIQUE ID's in some places also. Once we have the above i'm sure we'll be able to help you further. Quote Link to comment https://forums.phpfreaks.com/topic/75623-character-fields-being-truncated/#findComment-382729 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.