I have a question regarding the ability to show the column names from my table/query.
What I'm looking to do is to be able to have my users enter their own query via a builder (Which I haven't built yet).
I've found a little test script from the net but it shows them in an array.
My code is
Code: [Select]<?php
include('includes/inc.conn.php');
mysql_select_db("discover_messaging");
$result = mysql_query("SHOW COLUMNS FROM `messages`");
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
print_r($row);
}
}
?>
Which outputs
QuoteArray ( [Field] => msg_id [Type] => int(11) [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment ) Array ( [Field] => msg_to [Type] => varchar(99) [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => msg_from [Type] => varchar(99) [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => msg_subject [Type] => varchar(255) [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => msg_body [Type] => text [Null] => NO [Key] => [Default] => [Extra] => ) Array ( [Field] => read_flg [Type] => varchar(3) [Null] => NO [Key] => [Default] => off [Extra] => ) Array ( [Field] => sent_date [Type] => varchar(255) [Null] => NO [Key] => [Default] => [Extra] => )
Is there a way to have the field names come out of the array so that I can do something like?
Code: [Select]<table>
<tr>
<td>msg_id</td>
<td>msg_to</td>
etc ...
Thanks all.
Why is my row count 0?
Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.Here are things i know.1. The data passed is passed correctly, and is correct as far as data goes.2.
MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them in database. I have issues while inserting...foreach ($sentences as $final) {......else {
mysql_query returning boolean instead of mysql ressource
Hi,I seem to have a weird issue with the php command mysql_query. I pass 2 arguments the query in a string format (SQL is working properly) and a database ressource which is also good. The problem is
$_POST
Hi, I have 2 seperate php files, and i want my $_POSt["fname"] To go into both of them, For Example:Goto: http://ucp.south-westrp.com/UCP.phpType Username: Comptons_Eazy_EAnd Password:
How to secure my login data to my database?
Hi there,It may be a stupid question but I don't know how to secure my login data to my database. I have created an include file in order not to have these data in the code of my pages, but I don't
Including calander to page - will not show other months than current??
im trying to add an existaing calander onto a profile page by using Code: <?php include "diary/cal_show.php";?>which looks like this...But when i hit either arrows to move on
I need an iframe that calls up a different page according to the date
hiI don't know any php (only html) and I urgently need to do the following: I need an iframe that calls up a different page according to the date e.g. on the 2th Dec a page called 'special2.php',
Please help with code for SMTP authenticated PHP email form
Hello, I'm creating a PHP email form, and for this particular server, I have to use SMTP Authentication. They hosting service sent me this link: http://email.about.com/od/emailprogramm ...
values in array being escaped
I would like to submit some values - back to the same form for checking before processing...Code: [Select]<FORM method="post"><table width="500px"
how to make database item unique
Hey guys,is it possible to do this:I have the database item $title being pulled for the title and the actual clickable part of a link.Is it possible to make the $title in the link title unique?I ask