Jump to content


Photo

mysql_field_type-help returning sql type , and not php type


  • Please log in to reply
3 replies to this topic

#1 westnyorai

westnyorai
  • New Members
  • Pip
  • Newbie
  • 4 posts
  • LocationWY

Posted 04 April 2006 - 06:03 PM

I'm working on creating a database management script for my site. I'm having issues creating a script that will allow users to make changes to field names and datatypes.

But I'm having issues returning the SQL field type instead of the PHP field type.

The mysql_fieldtype command only returns string, num, blog, etc. instead of varchar, char, and such.

Is there a way I can use SQL to query the information and then fetch it?

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 04 April 2006 - 11:23 PM

DESCRIBE mytablename

[a href=\"http://dev.mysql.com/doc/refman/5.0/en/describe.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/describe.html[/a]

#3 westnyorai

westnyorai
  • New Members
  • Pip
  • Newbie
  • 4 posts
  • LocationWY

Posted 05 April 2006 - 12:03 PM

[!--quoteo(post=361774:date=Apr 4 2006, 06:23 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Apr 4 2006, 06:23 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
DESCRIBE mytablename

[a href=\"http://dev.mysql.com/doc/refman/5.0/en/describe.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/describe.html[/a]
[/quote]

ah, cool, that actually saves me a lot more time then using php. thanks, but now i have to figure out how to return only certain parts to php, but that shouldn't be too difficult. I'll work on it later tonight after i get back from class/work

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 06 April 2006 - 06:24 AM

Doesn't 5.0 have magic INFORMATION_SCHEMA functions for this?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users