mysql

Combine SQL statement

I have 3 tables (follows, postings, users) follows has 2 fields -> profile_id , following_id postings has 3 fields -> post_id, profile_id, content users has 3 fields -> profile_id, first_name, last_name I have a follows.profile_id value of 1 that I want to match against. When I run the SQL statement below I get the 1st step in obtai...

Storing Credit Card Numbers in SESSION - ways around it?

I am well aware of PCI Compliance so don't need an earful about storing CC numbers (and especially CVV nums) within our company database during checkout process. However, I want to be safe as possible when handling sensitive consumer information and am curious how to get around passing CC numbers from page to page WITHOUT using SESSION...

i'm trying to call a set of results from a database, not working

hi, i'm trying to re-use and old website I made for an assignment, but I want to be able to keep the same format across the whole site. this is the html/php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org /TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head...

How to recognize what indexes are not used?

I have a table in MySQL with 7 indexes, most of them are on more than one column. I think here is too much indexes. Is there any way to get statistics of what indexes are used more by all thousands of queries to this database and what are less worthy so I know what index to consider to remove in first place? ...

How to create index faster?

I have 10mln rows in my table in MySQL and 7 indexes on this table. Now when I try to add 8th it takes infinite time to do this. Is there any way to workaround this problem to add easily and fast 8th index? ...

php mySQL, retrieve one row by number, store values as assoc.array

Pretty new to all this, so if I am going about my puzzle in a crazy way please tell me! I have a table in a mySQL database with the columns title, hyperlink, imagelink I want the php to select a row at random, then be able to save the title, hyperlink and imagelink as php variables. (so I can then output them into html) so I could hav...

searching for multiple columns mysql and php

i'm trying to search for multiple columns using this code: <?php // Connection Database $search = $_POST ['Search']; mysql_connect("xxxxxx", "xxxxxx", "xxxxx") or die ("Error Connecting to Database"); mysql_select_db("xxxxx") or die('Error'); $data = mysql_query("SELECT CourseName, CourseDescription, CourseLeader FROM course ...

Extract the Day / Month / Year from a Timestamp on MYSQL

Hello, I have : $date = $actualite['date']; $actualite['date'] is a TIMESTAMP and i was wondering how i can extract from this timestamp the day, then the month, then the year in 3 variables. Thank you for your help : ...

The table '#sql-5f8_9c' is full

hello, im trying to delete a foreign key with the following syntax (5.0.45-community-nt): alter table [table] drop foreign key [fk_name] but I'm getting the following error: The table '#sql-5f8_9c' is full – 99543 ms any ideas? thanks! ...

change column widths in mysql query

<?php // Connection Database $search = $_POST ['Search']; mysql_connect("xxxxxx", "xxxxxxxxx", "xxxxxx") or die ("Error Connecting to Database"); mysql_select_db("xxxxxx") or die('Error'); $data = mysql_query("SELECT* FROM course WHERE MATCH (CourseName, CourseDescription, CourseLeader) AGAINST ('". $search ."')") ...

Generating Unordered List with PHP + CodeIgniter from a MySQL Database

Hello Everyone, I am trying to build a dynamically generated unordered list in the following format using PHP. I am using CodeIgniter but it can just be normal php. This is the end output I need to achieve. <ul id="categories" class="menu"> <li rel="1"> Arts &amp; Humanities <ul> <li rel="2"> Photography ...

Making Browser Auto-Scroll to Most Recently Submitted Comment.

Hello, I made a comment on a Wordpress blog and I noticed that after I submitted the comment, the top of the browser was flush with the top of my comment. In other words, the web page was auto-scrolled down to the top of my comment. How can I do this? I am using a comment system with PHP / MySQL. Thanks in advance, John ...

How to pass an array of objects trough a jquery $.post?

Hi, I want to pass the result of a query trough a $.post. function GetAllTasks() { $sql = "select t.id as task_id, description, createdat, createdby, max_requests, max_duration, j.name as job_name from darkfuture.tasks t...

which is better, creating a materialized view or a new table?

I have some demanding mysql queries that have to select same frequently updated datasets from 5-7 mysql tables. 'Select' operation would be a bit more than CUD. I am thinking of creating a table or materialized view to gather all demanding columns from other tables, so as to reduce overall query times to different tables and thus incre...

using jquery growl with php/mysql

on my database i am planning to create a table storing messages to alert users of anything they need to do. i am looking at using a jQuery growl like notification method but im confused at how i would begin building it. the data would be added into the database using the standard MYSQL insert method from a form but how would i select...

Modifying a MySQL database on a Ruby on Rails install

Hello, sorry if this questions is overly basic or has been asked before but I simply cannot figure it out. On my Ruby on Rails site, I have a controller that accesses the fields of a table in my database and displays their "Name" field as a drop-down menu in one of my views. My problem is I need to change the options of that dropdown me...

extensible database design: automatic ALTER TABLE or serialize() field BLOB ?

I want an adaptable database scheme. But still use a simple table data gateway in my application, where I just pass an $data[] array for storing. The basic columns are settled in the initial table scheme. There will however arise a couple of meta fields later (ca 10-20). I want some flexibility there and not adapt the database manually e...

Any disadvantages to this tagging approach

I have a table of tags ID tag --- ------ 1 tagt 2 tagb 3 tagz 4 tagn In my items table, I'm using those tags in serialized format, comma delimited ID field1 tags ---- ------ ----- 1 value1 tagt,tagb 2 value2 tagb 3 value3 tagb,tagn 4 ...

Creating a Comment Anchor

Hello, The function below allows a user to insert a comment into a MySQL table called "comment." Then, the file "comments2.php" displays all comments for a given submission. Right after a user submits a comment, I would like the top of the user's browser to be anchored by the comment the user just submitted. How can I do this? Tha...

What are some methods to prevent double posting in a form? (PHP)

I want to prevent users from accidentally posting a comment twice. I use the PRG (post redirect get) method, so that I insert the data on another page then redirect the user back to the page which shows the comment. This allows users to refresh as many times as they want. However this doesn't work when the user goes back and clicks subm...