Jump to content

Recommended Posts

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 ?

Link to comment
https://forums.phpfreaks.com/topic/75623-character-fields-being-truncated/
Share on other sites

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

 

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

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.