29 lines
958 B
Python
29 lines
958 B
Python
import pymysql
|
|
import json
|
|
|
|
conn = pymysql.connect(
|
|
user='root',
|
|
database='sisvietnam_db',
|
|
unix_socket='/home/x79/.local/mariadb/mariadb-10.6.14-linux-x86_64/mysql.sock'
|
|
)
|
|
|
|
cursor = conn.cursor(pymysql.cursors.DictCursor)
|
|
|
|
# Check what post types exist
|
|
cursor.execute("SELECT post_type, COUNT(*) as cnt FROM sis_posts GROUP BY post_type;")
|
|
print("--- Post Types ---")
|
|
for row in cursor.fetchall():
|
|
print(f"{row['post_type']}: {row['cnt']}")
|
|
|
|
# Inspect Doctor meta
|
|
cursor.execute("SELECT ID, post_title FROM sis_posts WHERE post_type='doctor' LIMIT 1;")
|
|
doc = cursor.fetchone()
|
|
if doc:
|
|
print(f"\n--- Doctor Meta for {doc['post_title']} (ID {doc['ID']}) ---")
|
|
cursor.execute("SELECT meta_key, meta_value FROM sis_postmeta WHERE post_id=%s;", (doc['ID'],))
|
|
for m in cursor.fetchall():
|
|
val = m['meta_value'][:50] + '...' if len(m['meta_value']) > 50 else m['meta_value']
|
|
print(f"{m['meta_key']}: {val}")
|
|
|
|
conn.close()
|